A rendering method and device of a three-dimensional model, a computer device and a storage medium
By calculating the transparency masking map and effect map of dynamic effects in real time, the production process of dynamic effects for 3D models is simplified, solving the problems of complex production and difficult-to-control effects in existing technologies, and achieving better display of dynamic effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING SWEET SUGARSOFT TECH CO LTD
- Filing Date
- 2022-07-29
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies for creating dynamic effects on 3D models are cumbersome and difficult to control, especially when implementing dissolution and generation effects of 3D models in augmented reality technology. Existing methods are poorly operable and fail to achieve the desired results.
By determining the initial transparency mask map and effect map of the color texture during the playback of dynamic effects, generating the target transparency mask map, and calculating the effect map of the special effects display in real time, the production process of dynamic effects is simplified and the display effect is improved.
There is no need to pre-create the model animation corresponding to the dynamic effects. The effects are calculated in real time, which simplifies the production process of dynamic effects and improves the dynamic effect display effect of 3D models.
Smart Images

Figure CN115272628B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of augmented reality technology, and more specifically, to a method, apparatus, computer device, and storage medium for rendering a three-dimensional model. Background Technology
[0002] Augmented Reality (AR) technology refers to the application of virtual information to the real world using computer technology, where the real environment and virtual objects are superimposed in the same scene or space in real time. Before superimposing virtual objects onto the real environment, a target 3D model of the virtual object is created. By rendering the target 3D model of the virtual object onto an image of the real environment, the real environment and the virtual object are superimposed and displayed. Additionally, special dynamic effects can be applied to the display of the 3D model; for example, entrance and exit effects corresponding to the 3D model. These dynamic effects are usually created using model animation, a relatively complex process. Summary of the Invention
[0003] This disclosure provides at least one method, apparatus, computer device, and storage medium for rendering a three-dimensional model.
[0004] In a first aspect, embodiments of this disclosure provide a method for rendering a three-dimensional model, including:
[0005] Obtain the target 3D model, color map, and effect map of dynamic effects applied to the target 3D model;
[0006] Determine the initial transparency mask texture of the color texture corresponding to the dynamic effect;
[0007] Based on the effect texture and the initial transparency mask texture, the special effect display texture and the target transparency mask texture corresponding to the dynamic special effect are determined.
[0008] Based on the special effects display texture, the target transparency mask texture, and the color texture, the target 3D model is rendered to obtain the rendered image of the dynamic special effects corresponding to the target 3D model during playback.
[0009] In this embodiment of the disclosure, there is no need to pre-create the model animation corresponding to the dynamic effects. The special effects display effect texture and the target transparency mask texture corresponding to the dynamic effects can be calculated in real time when rendering the 3D model. The target transparency mask texture can mask the target 3D model to different degrees and in different positions, while the special effects display effect texture is used to render the specific effects of the dynamic effects on the target 3D model. Therefore, the production process of dynamic effects is simplified and the display effect of dynamic effects is improved.
[0010] In one optional implementation, determining the target transparency mask texture during the playback of the dynamic effect includes:
[0011] Determine the effect direction of the dynamic effect; the effect direction is used to indicate the dissolution direction of the target 3D model during the dissolution and disappearance process in the world coordinate system, or the generation direction during the appearance process;
[0012] Based on the direction of the special effect and the size information of the dynamic special effect during the dissolution or appearance process, the dynamic special effect effective area is determined.
[0013] An initial transparency mask texture is generated based on the direction of the special effect and the area where the dynamic special effect is effective.
[0014] In this way, users can set different effects directions to change the specific effects of dynamic effects, making dynamic effects more controllable.
[0015] In one optional implementation, the initial transparency mask map includes: grayscale values corresponding to a plurality of first pixels; the grayscale values are used to characterize the transparency of the corresponding second pixel in the color map;
[0016] The step of generating an initial transparency mask texture based on the direction of the special effect and the area where the dynamic special effect is effective includes:
[0017] Based on the direction of the special effect and the area where the dynamic special effect is active, a first region and a second region of the initial transparency mask texture are determined; wherein, the first region includes: the disappearing region of the target 3D model during the dissolution and disappearance process, or the region that has appeared during the appearance process; the second region includes: the region of the target 3D model that has not disappeared during the dissolution and disappearance process, or the region that has not appeared during the appearance process;
[0018] The pixel values of each pixel in the first region of the initial transparency mask texture are determined as the first grayscale value, and the pixel values of each pixel in the second region are determined as the second grayscale value;
[0019] Based on the distance between each pixel in the dynamic effect effective area and the first or second area, the first gray value, and the second gray value, the gray value of each pixel in the dynamic effect effective area is determined.
[0020] In this way, the first and second regions of the initial transparency mask texture can be determined according to the actual display needs, and the corresponding grayscale value features can be displayed. Additionally, parameters during the initial transparency mask texture generation process can be controlled to change. For example, in one optional implementation of the dynamic effect generation area, the effect texture includes: multiple effect regions; different grayscale values of pixels in adjacent effect regions; and grayscale values of pixels in different effect regions representing the transparency of that effect region.
[0021] Determining the target transparency mask texture during the playback of the dynamic special effects includes:
[0022] The multiple special effect areas in the effect texture map and the initial transparency mask texture map are merged to obtain a merged texture map;
[0023] Based on the fused texture, the target transparency mask texture is obtained.
[0024] In this way, a target transparency mask map can be obtained, which includes both the effect map and the initial transparency mask map.
[0025] In one optional implementation, the step of fusing the effect texture and the initial transparency mask texture to obtain a blended texture includes:
[0026] The pixel values of the first pixels corresponding to the multiple special effect areas in the effect texture and the second pixels in the initial transparency mask texture are subtracted to obtain a blended texture.
[0027] In one optional implementation, determining the special effects display texture based on the effect texture and the initial transparency mask texture includes:
[0028] Obtain the effective size information of the effect texture; the effective size information includes: first effective size information and / or second effective size information; the first effective size information is used to characterize the size of the effect texture; the second effective size information is used to characterize the total size of the effect texture and the self-illumination effect corresponding to the effect texture;
[0029] Based on the effective size information of the effect map, the pixel values of each pixel in the blended map are adjusted to obtain the effect effective range map; wherein, the effect effective range is used to characterize the coverage area of the dynamic effect on the target 3D model;
[0030] The color texture, the effect range texture, and the effect color information are fused together to obtain the effect display texture.
[0031] This allows for the display of special effects textures within a specific area.
[0032] In one optional implementation, adjusting the pixel values of each pixel in the blended texture based on the effective size information of the effect texture to obtain an effect effective range texture includes:
[0033] Based on the effective size information, the pixel values of each pixel in the full-area effect image are adjusted to obtain an intermediate texture.
[0034] Based on the preset first limit value and the preset second limit value, the pixel values of each pixel in the intermediate texture are adjusted to obtain the texture of the special effect range.
[0035] This allows you to filter and adjust pixel information that does not meet the requirements.
[0036] In one optional implementation, the special effect color information includes the main color corresponding to the color map. The process of fusing the color map, the special effect effective area map, and the special effect color information to obtain the special effect display effect map includes:
[0037] After adjusting the color of the color map using the main color, an adjusted color map is obtained;
[0038] The effect range texture is linearly interpolated using the adjusted color texture to obtain the effect display texture.
[0039] In this way, color textures can be added on top of the main color to obtain special effects textures, thereby enhancing the visual effect.
[0040] In one optional implementation, the special effect color information further includes: the special effect color of the dynamic special effect, and the self-illumination intensity of the dynamic special effect;
[0041] The effect range texture is linearly interpolated using the adjusted color texture to obtain the effect display texture, including:
[0042] By using the adjusted color map, the special effect color, and the self-illumination intensity, linear interpolation is performed on the special effect effective range map to obtain the special effect display effect map.
[0043] This allows for the addition of additional color effects to the target 3D model, enhancing its visual appeal.
[0044] Secondly, embodiments of this disclosure also provide a rendering apparatus for a three-dimensional model, comprising:
[0045] The acquisition module is used to acquire the target 3D model, color texture, and effect texture of dynamic effects applied to the target 3D model;
[0046] The first determining module is used to determine the initial transparency masking texture of the color texture corresponding to the dynamic effect;
[0047] The second determining module is used to determine the special effect display effect texture and the target transparency mask texture corresponding to the dynamic special effect based on the effect texture and the initial transparency mask texture.
[0048] The rendering module is used to render the target 3D model based on the special effects display texture, the target transparency mask texture, and the color texture, so as to obtain the rendered image of the dynamic special effects corresponding to the target 3D model during playback.
[0049] In one optional implementation, the first determining module includes:
[0050] The first determining unit is used to determine the effect direction of the dynamic special effect; the effect direction is used to indicate the dissolution direction of the target 3D model in the process of dissolving and disappearing in the world coordinate system, or the generation direction in the process of appearing.
[0051] The second determining unit is used to determine the dynamic effect effective area of the dynamic effect based on the direction of the special effect and the size information of the dynamic effect during the dissolution or disappearance process or the appearance process.
[0052] The generation unit is used to generate an initial transparency mask texture based on the direction of the special effect and the area where the dynamic special effect is effective.
[0053] In one optional implementation, the initial transparency mask map includes: grayscale values corresponding to a plurality of first pixels; the grayscale values are used to characterize the transparency of the corresponding second pixel in the color map;
[0054] The generation unit is specifically used for:
[0055] The step of generating an initial transparency mask texture based on the direction of the special effect and the area where the dynamic special effect is effective includes:
[0056] Based on the direction of the special effect and the area where the dynamic special effect is active, a first region and a second region of the initial transparency mask texture are determined; wherein, the first region includes: the disappearing region of the target 3D model during the dissolution and disappearance process, or the region that has appeared during the appearance process; the second region includes: the region of the target 3D model that has not disappeared during the dissolution and disappearance process, or the region that has not appeared during the appearance process;
[0057] The pixel values of each pixel in the first region of the initial transparency mask texture are determined as the first grayscale value, and the pixel values of each pixel in the second region are determined as the second grayscale value;
[0058] Based on the distance between each pixel in the dynamic effect effective area and the first or second area, the first gray value, and the second gray value, the gray value of each pixel in the dynamic effect effective area is determined.
[0059] In one optional implementation, the effect map includes: multiple effect regions; the grayscale values of pixels in adjacent effect regions are different; the grayscale values of pixels in different effect regions represent the transparency of the effect region;
[0060] The second determining module includes:
[0061] The first fusion unit is used to fuse multiple special effect areas in the effect texture and the initial transparency mask texture to obtain a fused texture.
[0062] Based on the fused texture, the target transparency mask texture is obtained.
[0063] In one optional implementation, the first fusion unit is specifically used for:
[0064] The pixel values of the first pixels corresponding to the multiple special effect areas in the effect texture and the second pixels in the initial transparency mask texture are subtracted to obtain a blended texture.
[0065] In one optional implementation, the second determining module further includes:
[0066] An acquisition unit is configured to acquire the effective size information of the effect texture; the effective size information includes: first effective size information and / or second effective size information; the first effective size information is used to characterize the size of the effect texture; the second effective size information is used to characterize the total size of the effect texture and the self-illumination effect corresponding to the effect texture;
[0067] An adjustment unit is used to adjust the pixel values of each pixel in the blended texture based on the effective size information of the effect texture to obtain an effect effective range texture; wherein, the effect effective range is used to characterize the coverage area of the dynamic effect on the target 3D model;
[0068] The second fusion unit is used to perform fusion processing on the color map, the effect effective range map, and the effect color information to obtain the effect display effect map.
[0069] In one optional implementation, the effective size information includes: first effective size information and / or second effective size information;
[0070] The first effective size information is used to characterize the size of the effect texture itself; the second effective size information is used to characterize the total size of the effect texture and the self-illumination effect corresponding to the effect texture.
[0071] In one optional implementation, the adjustment unit is specifically used for:
[0072] Based on the effective size information, the pixel values of each pixel in the full-area effect image are adjusted to obtain an intermediate texture.
[0073] Based on the preset first limit value and the preset second limit value, the pixel values of each pixel in the intermediate texture are adjusted to obtain the texture of the special effect range.
[0074] In one optional implementation, the special effects color information includes the primary color corresponding to the color map, and the second fusion unit is specifically used for:
[0075] After adjusting the color of the color map using the main color, an adjusted color map is obtained;
[0076] The effect range texture is linearly interpolated using the adjusted color texture to obtain the effect display texture.
[0077] In one optional implementation, the special effect color information further includes: the special effect color of the dynamic special effect, and the self-illumination intensity of the dynamic special effect;
[0078] The second fusion unit is also used for:
[0079] By using the adjusted color map, the special effect color, and the self-illumination intensity, linear interpolation is performed on the special effect effective range map to obtain the special effect display effect map.
[0080] Thirdly, embodiments of this disclosure also provide a computer device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the memory via the bus, and 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.
[0081] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the first aspect or any possible implementation of the first aspect.
[0082] For a description of the rendering device, computer equipment, and computer-readable storage medium used for the above-mentioned 3D model, please refer to the description of the rendering method for the above-mentioned 3D model, which will not be repeated here.
[0083] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this disclosure.
[0084] This disclosure provides a method, apparatus, computer device, and storage medium for rendering a 3D model. It determines an initial transparency mask texture of a color texture during dynamic effect playback, and based on this initial transparency mask texture and the effect texture of the dynamic effect, determines an effect display texture and a target transparency mask texture during the dynamic effect playback. Then, it renders the target 3D model using the color texture, the generated effect display texture, and the target transparency texture. This eliminates the need to pre-create the model animation corresponding to the dynamic effect; the effect display texture and target transparency mask texture can be calculated in real-time during 3D model rendering. The effect display texture is then used to render the specific effect of the dynamic effect on the target 3D model, thus simplifying the dynamic effect production process and improving the display effect of the dynamic effect.
[0085] 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
[0086] 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.
[0087] Figure 1 A flowchart illustrating a method for rendering a three-dimensional model provided in an embodiment of this disclosure is shown;
[0088] Figure 2This illustration shows a specific example of rendering a target 3D model using color mapping to obtain a rendered image, as provided in an embodiment of this disclosure.
[0089] Figure 3 This diagram illustrates the determination of effect textures corresponding to dynamic effects in the rendering method of a 3D model provided in this embodiment of the present disclosure.
[0090] Figure 4 A schematic diagram of the initial transparency mask texture generated in the rendering method of the three-dimensional model provided in the embodiments of this disclosure is shown;
[0091] Figure 5 A specific example of the target transparency mask texture generated in the rendering method of the three-dimensional model provided in the embodiments of this disclosure is shown;
[0092] Figure 6 This illustration shows a specific example of the rendered image corresponding to each of the three playback moments provided in the embodiments of this disclosure;
[0093] Figure 7 A schematic diagram of a rendering apparatus for a three-dimensional model provided in an embodiment of the present disclosure is shown;
[0094] Figure 8 A schematic diagram of the first determining module in the rendering apparatus for a three-dimensional model provided in this embodiment of the present disclosure is shown.
[0095] Figure 9 A detailed schematic diagram of the second determining module in the rendering apparatus for a three-dimensional model provided in an embodiment of this disclosure is shown.
[0096] Figure 10 A schematic diagram of a computer device provided in an embodiment of this disclosure is shown. Detailed Implementation
[0097] 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 in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings 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.
[0098] Research has revealed that "appearance" is a rendering method for 3D models. It's a display effect that shows a virtual object's 3D model within an image of a real-world scene. Under this effect, the target 3D model exhibits a dynamic transformation process: from an undisplayed state to a gradually appearing edge, and finally to a fully displayed state. For example, it can be used for entrance effects when a 3D model enters a virtual scene.
[0099] Dissolve and disappear is another rendering method for 3D models. Its process is the opposite of the appearance and generation process of 3D models. It is a dynamic process in which the 3D model rendered in the scene gradually dissolves from one edge and the dissolving position gradually moves to the other end until it is no longer displayed. For example, it can be used as an exit effect when a 3D model leaves the virtual scene.
[0100] In the two rendering methods described above, adding dynamic effects to the edges of the dissolved or generated 3D model is an important issue that needs to be addressed in computer vision, game vision, and 3D model reconstruction. These rendering methods have significant applications in many fields, such as AR artifact display, game character generation, and game character appearance. Currently, implementing these dynamic effects is quite complex. Specifically, when creating the shaded model for this effect using the Unity engine and the Amplify Shader Editor, many factors need to be considered. Firstly, it's necessary to determine the dissolution and generation directions of the 3D model. Secondly, it's necessary to consider how to give the 3D model a special edge effect during the dissolution and reconstruction process. In this embodiment, the generation of the 3D model does not refer to the process of constructing the 3D model, but rather the process of displaying the target 3D model from scratch in the AR scene during AR display.
[0101] Most 3D dynamic special effects are achieved using particle effects and model animation. Particle effects, which simulate real-world effects like water, fire, fog, and gas, are created using modules developed by various 3D software. The principle is to combine countless individual particles to form a fixed shape, and then control their overall or individual movement using controllers and scripts to simulate realistic effects. 3D model animation refers to the process of using various expressive forms to represent complex and abstract program content, scientific principles, and abstract concepts in a concentrated, simplified, vivid, and engaging way. However, both of these methods have poor controllability, making it difficult to achieve the desired effects, and are also relatively cumbersome to produce.
[0102] Based on the above research, this disclosure provides a method for rendering a 3D model. It determines the initial transparency masking map of the color texture during dynamic effect playback, and based on this initial transparency masking map and the effect map of the dynamic effect, determines the special effect display map and the target transparency masking map during the dynamic effect playback. Then, it uses the color texture, the generated special effect display map, and the target transparency map to render the target 3D model. This eliminates the need to pre-create the model animation corresponding to the dynamic effect; the special effect display map and the target transparency masking map can be calculated in real-time during the rendering of the 3D model. The target transparency masking map can mask the target 3D model to different degrees and positions, while the special effect display map is used to render the specific effects of the dynamic effect on the target 3D model. Therefore, it simplifies the production process of dynamic effects and improves the display effect of dynamic effects.
[0103] 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.
[0104] 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.
[0105] To facilitate understanding of this embodiment, a detailed description of a three-dimensional model rendering method disclosed in this disclosure is provided first. The execution entity of the three-dimensional model rendering method provided in this disclosure is generally a computer device with certain computing capabilities. This computer device may include, for example, an AR device, a server, or other processing devices. The AR device can 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 three-dimensional model rendering method can be implemented by a processor calling computer-readable instructions stored in memory.
[0106] The rendering method of the three-dimensional model provided in this embodiment will be described below, taking an AR device as the execution subject as an example.
[0107] See Figure 1 The diagram shows a flowchart of a three-dimensional model rendering method provided in this embodiment of the present disclosure. The method includes steps S101 to S104, wherein:
[0108] S101: Obtain the target 3D model, color map, and effect map of dynamic effects applied to the target 3D model.
[0109] In this embodiment of the disclosure, the target 3D model can be a 3D model obtained by 3D modeling based on the external shape of a virtual target object using 3D technology. 3D modeling refers to establishing a mathematical model of a 3D object suitable for computer representation and processing. It is the foundation for processing, manipulating, and analyzing the properties of a 3D object in a computer environment, and a key technology for establishing virtual reality that expresses the objective world in a computer.
[0110] When generating a target 3D model, for example, you can first design a 2D image design of the target object corresponding to the 3D model, and then perform 3D modeling based on the 2D image design.
[0111] In another possible implementation, the target 3D model can also be a 3D model obtained by 3D reconstruction based on the external shape of the real target object; for example, the target object in the 2D image can be 3D reconstructed, and the target 3D model corresponding to the target object in the 2D image can be obtained by using 3D reconstruction technology.
[0112] For example, when the target object is a large sheep, it can be reconstructed in three dimensions based on the sheep's two-dimensional image information, the sheep's world location information, and the transformed location information to obtain a target three-dimensional model located at the target location in the virtual world.
[0113] For example, if the target object is a cartoon character drawn by drawing, you can directly perform a 3D model of the cartoon character to obtain the target 3D model of the cartoon character.
[0114] In this embodiment of the disclosure, a color map refers to a map that assigns different colors to different pixels in a target 3D model.
[0115] In reality, different areas on a color map have different colors. Since a color map is composed of multiple pixels, each pixel corresponds to a specific color, and these colors can be used to render the corresponding locations on the target 3D model.
[0116] Specifically, color mapping is used to add color effects when rendering a target 3D model. In practice, color mapping is used to add color effects to the target 3D model during rendering, thus achieving the coloring process of the target 3D model. After rendering the 3D model of the target object using color mapping, the resulting rendered image can reflect the specific texture of the target 3D model's surface.
[0117] likeFigure 2 As shown, a specific example is provided for rendering a target 3D model using color mapping to obtain a rendered image. In this example, the target 3D model is a 3D model obtained by 3D modeling a cartoon sheep with an astronaut image.
[0118] In this embodiment, the effect texture for applying dynamic effects to the target 3D model refers to the dynamic effects displayed on the surface of the target 3D model during the generation of the target 3D model and the subsequent display of the target 3D model. The effect texture includes: multiple effect regions; different grayscale values of pixels in adjacent effect regions; and grayscale values of pixels in different effect regions, representing the transparency of the effect region. The effect texture is used to describe the edge effects during the process of the target 3D model appearing from nothing, or during the process of the edge of the target 3D model changing from blurry to solid.
[0119] Dynamic effects are used to describe the changing state of a 3D model as it gradually appears from nothing to something, from one end to the other.
[0120] For example, refer to Figure 3 As shown, Figure 3 This diagram illustrates the determination of effect textures corresponding to dynamic effects in the rendering method for a 3D model provided in this embodiment. To display dynamic effects, the target 3D surface can be divided into multiple effect regions. These effect regions can be different shapes such as circles, rhombuses, or honeycomb shapes. For multiple effect regions of the same target 3D model, their shapes can be the same or different. Within the same effect region, the grayscale values corresponding to each pixel can be the same or different. However, for ease of operation, it can be assumed that the grayscale values of each pixel in a single effect region are the same. However, to distinguish different effect regions, different effect regions can be set, especially with adjacent effect regions having different grayscale values for each pixel.
[0121] For example, the dynamic effect can be a flashing graphic. When the graphic flashes, the flashing frequencies of multiple graphics can be the same or different, their brightness variation ranges can be the same or different, and their color variation ranges can be the same or different. In addition, the dynamic effect can also include flow, dissolution, venetian blinds, etc., which are not limited here.
[0122] Following S101 above, the rendering method for a three-dimensional model provided in this embodiment further includes:
[0123] S102: Determine the initial transparency mask texture of the color texture corresponding to the dynamic effect.
[0124] In this embodiment of the disclosure, the pixels in the initial transparency mask texture are called first pixels; the pixels in the color texture are called second pixels; wherein the first pixels and the second pixels have a one-to-one correspondence.
[0125] In this embodiment of the disclosure, the initial opacity mask includes: grayscale values corresponding to a plurality of first pixels; the grayscale values are used to characterize the transparency of the corresponding second pixel in the color map.
[0126] Reference Figure 4 As shown, Figure 4 This is a schematic diagram of the initial transparency mask texture generated in the rendering method of the three-dimensional model provided in this embodiment of the disclosure. Figure 4 In this model, different pixels may correspond to different grayscale values. Pixels on the same vertical axis have different grayscale values, and these values change linearly. If this initial transparency mask map and color map are used to render the target 3D model, the effect will be that the target 3D model gradually blurs and disappears from one end to the other.
[0127] In this embodiment of the disclosure, the initial transparency masking map during the playback of the dynamic special effects is determined by the following method:
[0128] Determine the effect direction of the dynamic effect; the effect direction is used to indicate the dissolution direction of the target 3D model during the dissolution and disappearance process in the world coordinate system, or the generation direction during the appearance process;
[0129] Based on the direction of the special effect and the size information of the dynamic special effect during the dissolution or appearance process, the dynamic special effect effective area is determined.
[0130] An initial transparency mask texture is generated based on the direction of the special effect and the area where the dynamic special effect is effective.
[0131] In this embodiment of the disclosure, the direction of the dynamic effects can be from top to bottom, from bottom to top, from left to right, from right to left, etc. Based on the determined direction of the effects, the target 3D model can be controlled to gradually appear or gradually dissolve and disappear. For example, when the target 3D model appears, if the direction of the effects is from bottom to top, the target 3D model will gradually appear from the bottom up, accompanied by dynamic effects.
[0132] In this embodiment of the disclosure, dynamic effects can have multiple different dynamic effect effective areas. For example, during the generation of the target 3D model, the dynamic effect corresponding to the dynamic effect takes effect at the edge position of the generated model and has definite size information. The dynamic effect is displayed in a certain dynamic effect effective area, such as displaying the dynamic effect in the dynamic effect effective area 1cm away from the edge.
[0133] For example, taking the target 3D model appearing from bottom to top, and the size of the dynamic effect being 1cm, the dynamic effect is fully displayed when it appears from the bottom. When the target 3D model exceeds 1cm, the dynamic effect is only displayed within the area where the dynamic effect is active, 1cm from the edge, until the target 3D model has completely appeared. The appearance or dissolution process in other directions is similar to the above process and will not be described in detail here.
[0134] like Figure 5 The image shown is a specific example of a target transparency mask texture generated in the rendering method for a 3D model provided in this embodiment of the disclosure. Figure 5 In this mode, the dynamic effect only applies to the bottom of the target 3D model, and the target transparency mask texture presents a honeycomb shape effect at the bottom of the target 3D model.
[0135] In this embodiment of the disclosure, since the effective areas of dynamic effects are different, the effective areas of dynamic effects can be determined, and an initial transparency mask texture can be generated accordingly.
[0136] In one possible implementation, generating an initial transparency mask texture based on the effect direction and the area where the dynamic effect is active includes the following:
[0137] The step of generating an initial transparency mask texture based on the direction of the special effect and the area where the dynamic special effect is effective includes:
[0138] Based on the direction of the special effect and the area where the dynamic special effect is active, a first region and a second region of the initial transparency mask texture are determined; wherein, the first region includes: the disappearing region of the target 3D model during the dissolution and disappearance process, or the region that has appeared during the appearance process; the second region includes: the region of the target 3D model that has not disappeared during the dissolution and disappearance process, or the region that has not appeared during the appearance process;
[0139] The pixel values of each pixel in the first region of the initial transparency mask texture are determined as the first grayscale value, and the pixel values of each pixel in the second region are determined as the second grayscale value;
[0140] Based on the distance between each pixel in the dynamic effect effective area and the first or second area, the first gray value, and the second gray value, the gray value of each pixel in the dynamic effect effective area is determined.
[0141] For example, the generation direction of the target 3D model is determined based on the special effect direction, and according to the generation direction, the end of the initial transparency mask texture that is the same as the generation direction is determined as the first region, and the corresponding first gray value of the first region is determined to be 0 (i.e., black); the end of the initial transparency mask texture that is opposite to the generation direction is determined as the second region, or the other end that is opposite to the first region is the second region, and the corresponding second gray value of the second region is determined to be 1 (i.e., white).
[0142] In this embodiment of the disclosure, based on the image processing principle of "black is transparent but white is opaque", the disappearing area in the dissolution process or the area that has appeared in the appearance process is determined as a first area with high transparency, and its corresponding first gray value is 0; correspondingly, the non-disappearing area in the dissolution process or the non-appearing area in the appearance process is determined as a second area with low transparency, and its corresponding second gray value is 1.
[0143] For example, in order to create a gradient effect, after determining the first gray value of the first region and the second gray value of the second region, the gray value of each pixel in the dynamic effect effective region can be determined according to the calculation method of arithmetic sequence or linear transformation based on the distance between each pixel in the dynamic effect effective region and the first region or the second region.
[0144] Following on from S102 above, the rendering method for the three-dimensional model further includes:
[0145] S103: Based on the effect texture and the initial transparency mask texture, determine the special effect display texture and the target transparency mask texture corresponding to the dynamic effect.
[0146] The effect texture includes: multiple effect regions; adjacent effect regions have different grayscale values of pixels; and the grayscale values of pixels in different effect regions represent the transparency of that effect region. The effect display texture is a texture with effect display effect applied to the effective range of the effect on the target 3D model. The target transparency mask texture is a texture obtained by fusing the effect texture and the initial transparency mask texture.
[0147] In this embodiment of the disclosure, the method for determining the target transparency mask texture during the playback of the dynamic special effects includes:
[0148] The multiple special effect areas in the effect texture map and the initial transparency mask texture map are merged to obtain a merged texture map;
[0149] Based on the fused texture, the target transparency mask texture is obtained.
[0150] For example, once the initial transparency mask is determined, an effect map is blended onto it based on the initial transparency mask to obtain an effect map with... Figure 5 The texture shown is similar to the target transparency mask texture, and is used as the target transparency mask texture.
[0151] In one possible implementation, the specific method for fusing the effect texture and the initial transparency mask texture to obtain the blended texture includes:
[0152] The pixel values of the first pixels corresponding to the multiple special effect areas in the effect texture and the second pixels in the initial transparency mask texture are subtracted to obtain a blended texture.
[0153] For example, in the process of blending based on the effect map and the initial transparency mask map, the pixel values of the effect map and the initial transparency mask map relative to the same pixel point can be determined first, and a positional subtraction operation can be performed. For example, for pixel point A, the first pixel value of the effect map is 0.8, the second pixel value of the initial transparency mask map is 0.6, then the third pixel value of the blended map corresponding to this pixel point is 0.2, thereby generating the blended map.
[0154] In this embodiment of the disclosure, the method for determining the special effects display texture based on the effect texture and the initial transparency mask texture includes:
[0155] Obtain the effective size information of the effect texture; the effective size information includes: first effective size information and / or second effective size information; the first effective size information is used to characterize the size of the effect texture; the second effective size information is used to characterize the total size of the effect texture and the self-illumination effect corresponding to the effect texture;
[0156] Based on the effective size information of the effect map, the pixel values of each pixel in the blended map are adjusted to obtain the effect effective range map; wherein, the effect effective range is used to characterize the coverage area of the dynamic effect on the target 3D model;
[0157] The color texture, the effect range texture, and the effect color information are fused together to obtain the effect display texture.
[0158] In this embodiment of the disclosure, the special effects display texture is not displayed at a random location, but in a specific area, and has preset effective size information. For example, during the display of special effects on the target 3D model, the effect texture is only displayed at the edge position of the generated model, and has definite effective size information, such as adding the effect texture within the dynamic special effects effective area 2cm away from the edge position of the generated model.
[0159] For example, for the same effect map, one can determine its map size, and another can use the effect map as a reference to add an emission effect and determine the map size to which the emission effect is added.
[0160] In one possible implementation, after determining the effective size information of the effect map and the effective range of the special effect, the pixel values of each pixel in the blended map can be adjusted to obtain the effective range map of the special effect, which includes a portion of the effective range map of the special effect with self-illumination effect and the remaining portion of the effective range map of the special effect without self-illumination effect. Then, the color map, the effective range map of the special effect, and the special effect color information are used for blending to obtain the special effect display effect map.
[0161] In one possible implementation, each pixel in the target transparency mask texture can be inverted and subtracted, that is, the color texture and the effect texture are superimposed to obtain the pixel value of each pixel, which represents the target transparency mask texture obtained after superimposing the color texture and the effect texture. The pixel value of each pixel in the target transparency mask texture represents the transparency.
[0162] In one possible implementation, a specific method for adjusting the pixel values of each pixel in the blended texture based on the effective size information of the effect texture to obtain the effect effective range texture includes:
[0163] Based on the effective size information, the pixel values of each pixel in the full-area effect image are adjusted to obtain an intermediate texture.
[0164] Based on the preset first limit value and the preset second limit value, the pixel values of each pixel in the intermediate texture are adjusted to obtain the texture of the special effect range.
[0165] Among them, the intermediate texture map can also be called the intermediate effect range texture map.
[0166] For example, the pixel values of each pixel in the intermediate texture are adjusted using the limiting value operation as shown in formula (1).
[0167]
[0168] Where x is the pixel value of each pixel, a is the first limit value, and b is the second limit value. Formula (1) is used to limit the pixel value obtained after inversion to the range of 0-1. Since the effective range of the special effect is in the middle, there may be pixel values less than 0 or greater than 1 during the calculation process, so by using the limit value operation, the pixel value of each pixel is adjusted to a gray value between 0 and 1. This can prevent the pixel value of each pixel in the grayscale image from exceeding the limit range, which would cause an error.
[0169] In one possible implementation, the special effect color information includes the main color corresponding to the color map. The process of fusing the color map, the special effect effective area map, and the special effect color information to obtain the special effect display texture includes:
[0170] After adjusting the color of the color map using the main color, an adjusted color map is obtained;
[0171] The effect range texture is linearly interpolated using the adjusted color texture to obtain the effect display texture.
[0172] Specifically, the method for adjusting the color of the color map using the primary color may include performing a dot product between the color map and the primary color to obtain an adjusted color map after adjusting the color of the color map using the primary color.
[0173] For example, the color of the target 3D model is adjusted based on the main color corresponding to each pixel and the color map to obtain an adjusted color map. Then, the adjusted color map is used to perform linear interpolation on the effect range map to obtain the effect display effect map.
[0174] For example, taking the target 3D model as a large sheep, the primary color of the pixels representing the sheep's wool is white; the primary color of the pixels representing the sheep's eyes is black, and so on. Then, color maps with different grayscale values are added to different pixels to obtain adjusted color maps. These adjusted color maps are then used to perform linear interpolation on the effect range map to obtain the effect display map.
[0175] In another possible implementation, the special effect color information further includes: the special effect color of the dynamic special effect, and the self-illumination intensity of the dynamic special effect;
[0176] The step of performing linear interpolation on the effect range texture using the adjusted color texture to obtain the effect display texture includes:
[0177] By using the adjusted color map, the special effect color, and the self-illumination intensity, linear interpolation is performed on the special effect effective range map to obtain the special effect display effect map.
[0178] For example, the special effect color information may include one or more of the following: material base color (Albedo), metallicity, smoothness, etc. Based on the above special effect colors and the self-illumination intensity of the dynamic special effect, linear interpolation is performed on the effect range map to obtain the special effect display effect map. Specifically, after performing a dot product on the adjustment color map and the special effect range map, special effect color information with self-illumination effect is obtained. Using the special effect color information with self-illumination effect, the color map can be adjusted, and linear interpolation is performed on the special effect range map to obtain the special effect display effect map.
[0179] Following on from S103 above, the rendering method for the three-dimensional model further includes:
[0180] S104: Based on the special effects display texture, the target transparency mask texture, and the color texture, render the target 3D model to obtain the rendered image of the dynamic special effects corresponding to the target 3D model during playback.
[0181] In this embodiment of the disclosure, after determining the special effects display texture, the target transparency mask texture, and the color texture, the target 3D model can be rendered to obtain the dynamic special effects corresponding to the target 3D model in the rendered image.
[0182] In some possible embodiments, the target 3D model is rendered at different times during playback, resulting in different rendered images corresponding to the target 3D model. For example... Figure 6 As shown, this embodiment of the disclosure also provides a specific example of the rendered image corresponding to each of the three playback moments. If the rendered image changes from a1 to a3 during the three playback moments, the dynamic effect process represents the growth and appearance of the target 3D model. If the rendered image changes from a3 to a1 during the three playback moments, the dynamic effect process represents the dissolution and disappearance of the target 3D model.
[0183] This embodiment of the disclosure determines the initial transparency masking map of the color texture during the playback of dynamic special effects, and based on the initial transparency masking map and the effect map of the dynamic special effects, determines the special effects display effect map and the target transparency masking map during the playback of the dynamic special effects. Then, the target 3D model is rendered using the color texture, the generated special effects display effect map, and the target transparency map. Therefore, it is not necessary to pre-create the model animation corresponding to the dynamic special effects. That is, the special effects display effect map and the target transparency masking map corresponding to the dynamic special effects can be calculated in real time when rendering the 3D model. The target transparency masking map can mask the target 3D model to different degrees and in different positions, while the special effects display effect map is used to render the specific effect of the dynamic special effects on the target 3D model. Therefore, the production process of dynamic special effects is simplified and the display effect of dynamic special effects is improved.
[0184] 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.
[0185] Based on the same inventive concept, this disclosure also provides a rendering device for a three-dimensional model corresponding to the rendering method for a three-dimensional model. Since the principle of the device in this disclosure for solving the problem is similar to the rendering method for a three-dimensional model described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0186] Reference Figure 7 The diagram shown is a schematic of a rendering apparatus for a three-dimensional model provided in an embodiment of this disclosure. The apparatus includes: an acquisition module 710, a first determination module 720, a second determination module 730, and a rendering module 740; wherein,
[0187] The acquisition module 710 is used to acquire the target 3D model, color texture, and effect texture of dynamic effects applied to the target 3D model;
[0188] The first determining module 720 is used to determine the initial transparency masking texture of the color texture corresponding to the dynamic effect;
[0189] The second determining module 730 is used to determine the special effect display effect texture and the target transparency mask texture corresponding to the dynamic special effect based on the effect texture and the initial transparency mask texture.
[0190] The rendering module 740 is used to render the target 3D model based on the special effects display texture, the target transparency mask texture, and the color texture, so as to obtain the rendered image of the dynamic special effects corresponding to the target 3D model during playback.
[0191] In one alternative implementation, refer to Figure 8 The diagram shown is a detailed schematic of the first determining module in the rendering apparatus for a three-dimensional model provided in this embodiment of the present disclosure. The first determining module 720 includes:
[0192] The first determining unit 721 is used to determine the effect direction of the dynamic effect; the effect direction is used to indicate the dissolution direction of the target three-dimensional model in the process of dissolving and disappearing in the world coordinate system, or the generation direction in the process of appearing.
[0193] The second determining unit 722 is used to determine the dynamic effect effective area of the dynamic effect based on the direction of the special effect and the size information of the dynamic effect during the dissolution or disappearance process or the appearance process.
[0194] The generation unit 723 is used to generate an initial transparency mask texture based on the direction of the special effect and the area where the dynamic special effect is effective.
[0195] In one optional implementation, the initial transparency mask map includes: grayscale values corresponding to a plurality of first pixels; the grayscale values are used to characterize the transparency of the corresponding second pixel in the color map;
[0196] The generation unit 723 is specifically used for:
[0197] The step of generating an initial transparency mask texture based on the direction of the special effect and the area where the dynamic special effect is effective includes:
[0198] Based on the direction of the special effect and the area where the dynamic special effect is active, a first region and a second region of the initial transparency mask texture are determined; wherein, the first region includes: the disappearing region of the target 3D model during the dissolution and disappearance process, or the region that has appeared during the appearance process; the second region includes: the region of the target 3D model that has not disappeared during the dissolution and disappearance process, or the region that has not appeared during the appearance process;
[0199] The pixel values of each pixel in the first region of the initial transparency mask texture are determined as the first grayscale value, and the pixel values of each pixel in the second region are determined as the second grayscale value;
[0200] Based on the distance between each pixel in the dynamic effect effective area and the first or second area, the first gray value, and the second gray value, the gray value of each pixel in the dynamic effect effective area is determined.
[0201] In one alternative implementation, refer to Figure 9The diagram shown is a detailed schematic of the second determining module in the rendering apparatus for a three-dimensional model provided in this embodiment of the present disclosure.
[0202] The effect texture includes: multiple effect areas; the grayscale values of pixels in adjacent effect areas are different; the grayscale values of pixels in different effect areas represent the transparency of the effect area;
[0203] The second determining module 730 includes:
[0204] The first fusion unit 731 is used to fuse multiple special effect areas in the effect texture and the initial transparency mask texture to obtain a fused texture.
[0205] Based on the fused texture, the target transparency mask texture is obtained.
[0206] In one optional implementation, the first fusion unit 731 is specifically used for:
[0207] The pixel values of the first pixels corresponding to the multiple special effect areas in the effect texture and the second pixels in the initial transparency mask texture are subtracted to obtain a blended texture.
[0208] In an optional implementation, the second determining module 730 further includes:
[0209] The acquisition unit 732 is used to acquire the effective size information of the effect texture; the effective size information includes: first effective size information and / or second effective size information; the first effective size information is used to characterize the size of the effect texture; the second effective size information is used to characterize the total size of the effect texture and the self-illumination effect corresponding to the effect texture;
[0210] The adjustment unit 733 is used to adjust the pixel values of each pixel in the blended texture based on the effective size information of the effect texture to obtain an effect effective range texture; wherein, the effect effective range is used to characterize the coverage area of the dynamic effect on the target 3D model;
[0211] The second fusion unit 734 is used to perform fusion processing on the color map, the effect effective range map, and the effect color information to obtain the effect display effect map.
[0212] In one optional implementation, the adjustment unit 733 is specifically used for:
[0213] Based on the effective size information, the pixel values of each pixel in the full-area effect image are adjusted to obtain an intermediate texture.
[0214] Based on the preset first limit value and the preset second limit value, the pixel values of each pixel in the intermediate texture are adjusted to obtain the texture of the special effect range.
[0215] In one optional implementation, the special effects color information includes the main color corresponding to the color map, and the second fusion unit 734 is specifically used for:
[0216] After adjusting the color of the color map using the main color, an adjusted color map is obtained;
[0217] The effect range texture is linearly interpolated using the adjusted color texture to obtain the effect display texture.
[0218] In one optional implementation, the special effect color information further includes: the special effect color of the dynamic special effect, and the self-illumination intensity of the dynamic special effect;
[0219] The second fusion unit 734 is also used for:
[0220] By using the adjusted color map, the special effect color, and the self-illumination intensity, linear interpolation is performed on the special effect effective range map to obtain the special effect display effect map.
[0221] This embodiment of the disclosure determines the initial transparency masking map of the color texture during the playback of dynamic special effects, and based on the initial transparency masking map and the effect map of the dynamic special effects, determines the special effects display effect map and the target transparency masking map during the playback of the dynamic special effects. Then, the target 3D model is rendered using the color texture, the generated special effects display effect map, and the target transparency map. Therefore, it is not necessary to pre-create the model animation corresponding to the dynamic special effects. That is, the special effects display effect map and the target transparency masking map corresponding to the dynamic special effects can be calculated in real time when rendering the 3D model. The target transparency masking map can mask the target 3D model to different degrees and in different positions, while the special effects display effect map is used to render the specific effect of the dynamic special effects on the target 3D model. Therefore, the production process of dynamic special effects is simplified and the display effect of dynamic special effects is improved.
[0222] 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.
[0223] This disclosure also provides a computer device, such as... Figure 10 The diagram shown is a schematic representation of a computer device structure provided in an embodiment of this disclosure, including:
[0224] Processor 11 and memory 12; the memory 12 stores machine-readable instructions executable by the processor 11, and the processor 11 executes the machine-readable instructions stored in the memory 12. When the machine-readable instructions are executed by the processor 11, the processor 11 performs the following steps:
[0225] Obtain the target 3D model, color map, and effect map of dynamic effects applied to the target 3D model;
[0226] Determine the initial transparency mask texture of the color texture corresponding to the dynamic effect;
[0227] Based on the effect texture and the initial transparency mask texture, the special effect display texture and the target transparency mask texture corresponding to the dynamic special effect are determined.
[0228] Based on the special effects display texture, the target transparency mask texture, and the color texture, the target 3D model is rendered to obtain the rendered image of the dynamic special effects corresponding to the target 3D model during playback.
[0229] The aforementioned memory 12 includes a main memory 121 and an external memory 122; the main memory 121, also known as internal memory, is used to temporarily store the computational data in the processor 11, as well as the data exchanged with external memory 122 such as a hard disk. The processor 11 exchanges data with the external memory 122 through the main memory 121.
[0230] The specific execution process of the above instructions can be referred to the steps of the three-dimensional model rendering method described in the embodiments of this disclosure, and will not be repeated here.
[0231] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the three-dimensional model rendering method described in the above method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0232] The computer program product of the three-dimensional model rendering method provided in this disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the steps of the three-dimensional model rendering method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.
[0233] This disclosure also provides a computer program that, when executed by a processor, implements any of the methods described in the foregoing embodiments. The computer program product can be implemented specifically 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.
[0234] This disclosure relates to the field of augmented reality (AR). It involves acquiring image information of target objects in a real-world environment and then using various visual algorithms to detect or identify the relevant features, states, and attributes of these objects, thereby achieving an AR effect that combines virtual and real elements to suit specific applications. For example, target objects may include human features such as faces, limbs, gestures, and movements; objects such as signs and markers; or venues such as sand tables, display areas, or displayed items. Visual algorithms may include visual localization, SLAM, 3D reconstruction, image registration, background segmentation, keypoint extraction and tracking of objects, and pose or depth detection. Specific applications can include interactive scenarios related to real-world scenes or objects, such as guided tours, navigation, explanations, reconstruction, and virtual effect overlay displays, as well as human-related special effects processing, such as makeup enhancement, limb enhancement, special effects displays, and virtual model displays. Convolutional neural networks (CNNs) can be used to detect or identify the relevant features, states, and attributes of target objects. The aforementioned CNNs are network models trained using deep learning frameworks.
[0235] 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.
[0236] 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.
[0237] 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.
[0238] 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.
[0239] 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 rendering a three-dimensional model, characterized in that, include: Obtain the target 3D model, color map, and effect map of dynamic effects applied to the target 3D model; Determine the initial transparency mask texture of the color texture corresponding to the dynamic effect; Based on the effect texture and the initial transparency mask texture, the special effect display texture and the target transparency mask texture corresponding to the dynamic special effect are determined. Based on the special effects display texture, the target transparency mask texture, and the color texture, the target 3D model is rendered to obtain the rendered image of the dynamic special effects corresponding to the target 3D model during playback; The step of determining the initial transparency mask texture corresponding to the color texture of the dynamic effect includes: Determine the effect direction of the dynamic effect; the effect direction is used to indicate the dissolution direction of the target 3D model during the dissolution and disappearance process in the world coordinate system, or the generation direction during the appearance process; Based on the direction of the special effect and the size information of the dynamic special effect during the dissolution or appearance process, the dynamic special effect effective area is determined. Based on the direction of the special effect and the area where the dynamic special effect is effective, an initial transparency mask texture is generated; The initial transparency mask texture includes: grayscale values corresponding to multiple first pixels; the grayscale values are used to characterize the transparency of the corresponding second pixel in the color texture. The step of generating an initial transparency mask texture based on the direction of the special effect and the area where the dynamic special effect is effective includes: Based on the direction of the special effect and the area where the dynamic special effect is active, a first region and a second region of the initial transparency mask texture are determined; wherein, the first region includes: the disappearing region of the target 3D model during the dissolution and disappearance process, or the region that has appeared during the appearance process; the second region includes: the non-disappearing region of the target 3D model during the dissolution and disappearance process, or the region that has not appeared during the appearance process; The pixel values of each pixel in the first region of the initial transparency mask texture are determined as the first grayscale value, and the pixel values of each pixel in the second region are determined as the second grayscale value; Based on the distance between each pixel in the dynamic effect effective area and the first area or the second area, the first gray value, and the second gray value, the gray value of each pixel in the dynamic effect effective area is determined; The effect texture includes: multiple effect areas; the grayscale values of pixels in adjacent effect areas are different; the grayscale values of pixels in different effect areas represent the transparency of the effect area; Determining the target transparency mask texture during the playback of the dynamic special effects includes: The multiple special effect areas in the effect texture map and the initial transparency mask texture map are merged to obtain a merged texture map; Based on the fused texture, the target transparency mask texture is obtained; The process of determining the special effects display texture based on the effect texture and the initial transparency mask texture includes: Obtain the effective size information of the effect texture; the effective size information includes: first effective size information and / or second effective size information; the first effective size information is used to characterize the size of the effect texture; the second effective size information is used to characterize the total size of the effect texture and the self-illumination effect corresponding to the effect texture; Based on the effective size information of the effect map, the pixel values of each pixel in the blended map are adjusted to obtain the effect effective range map; wherein, the effect effective range map is used to characterize the coverage area of the dynamic effect on the target 3D model; The color texture, the effect range texture, and the effect color information are fused together to obtain the effect display texture.
2. The method according to claim 1, characterized in that, The process of fusing multiple effect areas in the effect texture and the initial transparency mask texture to obtain a blended texture includes: The pixel values of the first pixels corresponding to the multiple special effect areas in the effect texture and the second pixels in the initial transparency mask texture are subtracted to obtain a blended texture.
3. The method according to claim 2, characterized in that, The step of adjusting the pixel values of each pixel in the blended texture based on the effective size information of the effect texture to obtain the effect effective range texture includes: Based on the effective size information, the pixel values of each pixel in the full-area effect image are adjusted to obtain an intermediate texture. Based on the preset first limit value and the preset second limit value, the pixel values of each pixel in the intermediate texture are adjusted to obtain the texture of the special effect range.
4. The method according to claim 3, characterized in that, The special effect color information includes the main color corresponding to the color texture. The process of fusing the color texture, the special effect effective area texture, and the special effect color information to obtain the special effect display texture includes: After adjusting the color of the color map using the main color, an adjusted color map is obtained; The effect range texture is linearly interpolated using the adjusted color texture to obtain the effect display texture.
5. The method according to claim 4, characterized in that, The special effect color information also includes: the special effect color of the dynamic special effect, and the self-illumination intensity of the dynamic special effect; The step of performing linear interpolation on the effect range texture using the adjusted color texture to obtain the effect display texture includes: By using the adjusted color map, the special effect color, and the self-illumination intensity, linear interpolation is performed on the special effect effective range map to obtain the special effect display effect map.
6. A rendering device for a three-dimensional model, characterized in that, The steps for performing the rendering method for the three-dimensional model according to claim 1 include: The acquisition module is used to acquire the target 3D model, color texture, and effect texture of dynamic effects applied to the target 3D model; The first determining module is used to determine the initial transparency masking texture of the color texture corresponding to the dynamic effect; The second determining module is used to determine the special effect display effect texture and the target transparency mask texture corresponding to the dynamic special effect based on the effect texture and the initial transparency mask texture. The rendering module is used to render the target 3D model based on the special effects display texture, the target transparency mask texture, and the color texture, so as to obtain the rendered image of the dynamic special effects corresponding to the target 3D model during playback.
7. A computer device, characterized in that, include: The computer device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, they perform the steps of the rendering method for a three-dimensional model 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 that, when executed by a processor, performs the steps of the rendering method for a three-dimensional model as described in any one of claims 1 to 5.