Decorative applique method and device, electronic equipment and computer readable storage medium

By calculating the normal coordinates of the decal target point and performing three-dimensional texture sampling, and calculating and rendering the target color, the problem of texture stretching during decal is solved and the decal effect is improved.

CN119579755APending Publication Date: 2025-03-07BEIJING PIXEL SOFTWARE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411634968.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

When performing decaling, if the decal position is a position formed by the intersection of multiple planes, such as the corner of the wall, the texture on the surface parallel to the decal facing is stretched, causing the decal effect to be worse.

Method used

By obtaining the decal model and when decaling the decal model is determined, the normal coordinates of the decal target point in the decal model are calculated; the decal model is sampled for three-dimensional texture, multiple texture colors are obtained, and the target color is calculated based on the normal coordinates and the multiple texture colors; the texture of the decal model is rendered on the decal target point according to the target color.

Benefits of technology

By combining normal coordinates and three-dimensional texture sampling, the target color is calculated and rendered, the problem of texture stretching during decaling is solved and the decal effect is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119579755A_ABST
    Figure CN119579755A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an applique method and device, electronic equipment and a computer readable storage medium, and relates to the technical field of computers. Obtaining a decal model, and calculating a normal coordinate of a decal target point in the decal model under the condition that decal is determined to be carried out on the decal model; performing three-dimensional texture sampling on the decal model to obtain a plurality of texture colors, and calculating a target color according to the normal coordinate and the plurality of texture colors; and rendering the texture of the decal model to the decal target point according to the target color. The normal of the decal target point can represent the surface gradient condition of the object to be decal, so that decal can be performed on the decal model in combination with the height information, the problem of texture stretching possibly existing when decal is performed on the position formed by intersection of a plurality of planes can be solved, and the decal effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a decal method, device, electronic device and computer-readable storage medium. Background Art

[0002] Decals are a technique used to add details to the surface of a 3D model, such as stains, bullet holes, footprints, wall graffiti, etc. Currently, when applying decals, if the decal location is a location where multiple planes intersect, such as a corner, the texture on the surface parallel to the decal direction will be stretched, making the decal effect worse. Summary of the invention

[0003] In view of this, the purpose of the present application is to provide a decal method, device, electronic device and computer-readable storage medium to solve the texture stretching problem that may exist during decals and improve the decal effect.

[0004] In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0005] In a first aspect, the present invention provides a decal method, the method comprising:

[0006] Acquire a decal model, and when determining to apply decals to the decal model, calculate the normal coordinates of a decal target point in the decal model;

[0007] Performing three-dimensional texture sampling on the decal model to obtain a plurality of texture colors, and calculating a target color according to the normal coordinates and the plurality of texture colors;

[0008] The texture of the decal model is rendered onto the decal target point according to the target color.

[0009] In an optional embodiment, after obtaining the decal model, the method further includes:

[0010] Determining a coordinate vector corresponding to the decal target point according to the position coordinates of the decal model and a preset depth map, and determining whether the decal target point is located in the model space of the decal model according to the coordinate vector;

[0011] If the decal target point is located in the model space of the decal model, it is determined to perform decaling on the decal model.

[0012] In an optional implementation, the position coordinates are two-dimensional coordinates of the decal model, and the coordinate vector is a four-dimensional coordinate vector; and determining the coordinate vector corresponding to the decal target point according to the position coordinates of the decal model and a preset depth map includes:

[0013] Determining a depth value corresponding to the decal target point according to the two-dimensional coordinates of the decal model and a preset depth map;

[0014] A four-dimensional coordinate vector corresponding to the decal target point is determined according to the two-dimensional coordinates of the decal model, the depth value of the decal target point, and a preset perspective value.

[0015] In an optional implementation, determining whether the decal target point is located in the model space of the decal model according to the coordinate vector includes:

[0016] Multiplying the four-dimensional coordinate vector by the MVP inverse matrix of the decal model to obtain a target coordinate vector of the decal target point; the target coordinate vector is a four-dimensional coordinate vector of the decal target point in the model space of the decal model;

[0017] If the x value, y value and z value of the target coordinate vector meet preset conditions, it is determined that the decal target point is located in the model space of the decal model.

[0018] In an optional embodiment, the three-dimensional texture sampling of the decal model to obtain a plurality of texture colors, and calculating a target color according to the normal coordinates and the plurality of texture colors, comprises:

[0019] Performing three-dimensional texture sampling on the decal model to obtain a first texture color of the decal model in an xz plane, a second texture color in a zy plane, and a third texture color in an xy plane;

[0020] The target color is calculated according to the normal coordinates, the first texture color, the second texture color, the third texture color and a preset formula.

[0021] In an optional implementation, the preset formula is characterized as:

[0022]

[0023] Wherein, C represents the target color, C 1 Characterize the first texture color, C 2 Characterize the second texture color, C 3 Characterizes the third texture color, n x Characterizes the normal x-axis coordinate, n y Represents the normal y-axis coordinate, n z Represents the normal z-axis coordinate.

[0024] In a second aspect, the present invention provides a decal device, the device comprising:

[0025] A calculation module, used for obtaining a decal model, and when determining to decal the decal model, calculating the normal coordinates of a decal target point in the decal model;

[0026] The calculation module is further used to perform three-dimensional texture sampling on the decal model to obtain multiple texture colors, and calculate the target color according to the normal coordinates and the multiple texture colors;

[0027] A decal module is used to render the texture of the decal model onto the decal target point according to the target color.

[0028] In an optional embodiment, the calculation module is also used to determine the coordinate vector corresponding to the decal target point based on the position coordinates of the decal model and a preset depth map, and determine whether the decal target point is located in the model space of the decal model based on the coordinate vector; if the decal target point is located in the model space of the decal model, it is determined to decal the decal model.

[0029] In a third aspect, the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the method described in any one of the aforementioned embodiments.

[0030] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described in any one of the aforementioned embodiments.

[0031] The decal method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application calculate the target color to be used for decals based on the normal coordinates of the decal target point in the decal model and the multiple texture colors obtained after three-dimensional texture sampling of the decal model, and then perform decals based on the target color. Since the normal of the decal target point can represent the surface slope of the object to be decaled, the decal model can be decaled in combination with the height information, thereby solving the texture stretching problem that may exist when decals are performed at the position where multiple planes intersect, thereby improving the decal effect.

[0032] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 A block diagram of an electronic device provided by an embodiment of the present application is shown;

[0035] Figure 2 A schematic diagram of a process of a decal method provided in an embodiment of the present application is shown;

[0036] Figure 3 Another schematic diagram of the process of the decal method provided in the embodiment of the present application is shown;

[0037] Figure 4 A functional module diagram of a decal device provided in an embodiment of the present application is shown.

[0038] Icon: 100 - memory; 110 - processor; 120 - communication module; 200 - computing module; 210 - decal module. DETAILED DESCRIPTION

[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0040] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0041] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0042] Please refer to Figure 1 , is a block diagram of an electronic device provided in an embodiment of the present application. The electronic device includes a memory 100, a processor 110, and a communication module 120. The memory 100, the processor 110, and the communication module 120 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0043] The memory 100 is used to store computer programs or data that can be executed by the processor. The memory 100 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc.

[0044] The processor 110 is used to read / write data or computer programs stored in the memory, and execute the computer program to implement the decal method provided in the embodiment of the present application.

[0045] The communication module 120 is used to establish a communication connection between the electronic device and other communication terminals through a network, and to send and receive data through the network.

[0046] It should be understood that Figure 1 The structure shown is only a schematic diagram of the structure of the electronic device. The electronic device may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0047] Next, the above Figure 1 The electronic device in the embodiment is the execution body, and the decal method provided in the embodiment of the present application is exemplarily introduced in combination with the flow chart.

[0048] Specifically, Figure 2 A schematic diagram of a process for the decal method provided in the embodiment of the present application is shown in FIG. Figure 2 , the method comprising:

[0049] Step S20, obtaining a decal model, and when it is determined that the decal model is to be decaled, calculating the normal coordinates of the decal target point in the decal model.

[0050] Optionally, the decal model may be a decal model input by a user, or may be a decal model calculated by an electronic device.

[0051] For example, the decal model may be a graffiti model created by a user when graffiti is applied to a wall, or may be a bullet hole model calculated by an electronic device when a user performs a shooting operation in a game, and so on.

[0052] Optionally, the decal target point refers to the surface position of the model to be decaled to which the decal needs to be applied, that is, the contact point or center point between the decal model and the model to be decaled.

[0053] Optionally, the electronic device may calculate the normal coordinates of the decal target point by the three-dimensional coordinates of the decal target point in the decal model. It is understandable that the normal coordinates are also three-dimensional coordinates.

[0054] In one example, if HLSL (High-Level Shading Language) is used, cross(ddy, ddx) may be used to calculate the normal coordinates of the decal target point in the decal model.

[0055] Among them, ddy represents the y-axis coordinate of the decal target point in the model space of the decal model, and ddx represents the x-axis coordinate of the decal target point in the model space of the decal model.

[0056] Step S21 , performing three-dimensional texture sampling on the decal model to obtain a plurality of texture colors, and calculating a target color according to the normal coordinates and the plurality of texture colors.

[0057] Optionally, the electronic device may perform three-dimensional texture sampling on the decal model to obtain texture colors corresponding to each main plane of the three-dimensional coordinates of the decal model.

[0058] Step S22, rendering the texture of the decal model onto the decal target point according to the target color.

[0059] It can be understood that the electronic device can implement decaling for the model to be decaled by rendering the texture of the decal model onto the decal target point according to the target color.

[0060] According to the decal method provided in the embodiment of the present application, the electronic device can calculate the target color that should be used for decal according to the normal coordinates of the decal target point in the decal model and the multiple texture colors obtained after three-dimensional texture sampling of the decal model, and then perform decals according to the target color. Since the normal of the decal target point can represent the surface slope of the object to be decaled, the decal model can be decaled in combination with the height information, thereby solving the texture stretching problem that may exist when decals are performed at the position where multiple planes intersect, thereby improving the decal effect.

[0061] Optionally, in order to prevent the decal from appearing in inappropriate positions or having a penetration effect, such as appearing inside the object to be decaled, or visually appearing to penetrate the model surface, the electronic device can first determine whether the decal target point is located in the model space of the decal model after acquiring the decal model.

[0062] Specifically, the electronic device may determine a coordinate vector corresponding to a decal target point according to the position coordinates of the decal model and a preset depth map, and determine whether the decal target point is located in the model space of the decal model according to the coordinate vector.

[0063] Optionally, the depth map refers to the depth map of the current scene. For example, if decals need to be applied to a game scene, the depth map refers to the depth map of the current game scene.

[0064] Optionally, the depth map records depth information of each pixel.

[0065] Optionally, since the position coordinates of the decal model can represent the position coordinates corresponding to the decal target point, a coordinate vector corresponding to the decal target point can be constructed according to the position coordinates of the decal model and the depth map.

[0066] In this embodiment, if the decal target point is located in the model space of the decal model, the electronic device may determine to apply the decal to the decal model.

[0067] Optionally, if the decal target point is located in the model space of the decal model, it can be ensured that the decal model can be correctly positioned and thus rendered on the model surface, otherwise, the decal error problem may occur. Therefore, the electronic device can decal the decal model when it is determined that the decal target point is located in the model space of the decal model, and give up decaling the decal model when the decal target point is not located in the model space of the decal model, thereby avoiding the decal error problem.

[0068] In a possible implementation manner, the position coordinates of the decal model may be two-dimensional coordinates.

[0069] In this embodiment, the two-dimensional coordinate refers to a two-dimensional coordinate in an NDC (Normalized Device Coordinates) space.

[0070] Optionally, the electronic device may first obtain the two-dimensional coordinates of the decal model in the screen space, and then convert the two-dimensional coordinates into the NDC space, thereby obtaining the two-dimensional coordinates of the decal model in the NDC space.

[0071] Optionally, the coordinate vector corresponding to the decal target point may be a four-dimensional coordinate vector.

[0072] In this embodiment, the electronic device can determine the depth value corresponding to the decal target point based on the two-dimensional coordinates of the decal model and a preset depth map, and thus determine the four-dimensional coordinate vector corresponding to the decal target point based on the two-dimensional coordinates of the decal model, the depth value of the decal target point and a preset perspective value.

[0073] Optionally, since the position coordinates of the decal model can represent the position coordinates corresponding to the decal target point, the electronic device can determine the depth value corresponding to the decal target point based on the two-dimensional coordinates of the decal model and the depth map.

[0074] In a possible implementation, the preset perspective value may be 1.0f.

[0075] Optionally, the electronic device may construct a four-dimensional coordinate vector (x, y, z, w) corresponding to the decal target point according to the two-dimensional coordinates x, y, depth value z and preset perspective value w of the decal model.

[0076] It can be understood that the four-dimensional coordinate vector constructed according to the two-dimensional coordinates of the decal model, the depth value of the decal target point and the preset perspective value is the coordinate vector of the decal target point in the NDC space.

[0077] Next, a possible implementation method is given for determining whether the decal target point is located in the model space of the decal model based on the coordinate vector.

[0078] Specifically, the electronic device may multiply the four-dimensional coordinate vector by the inverse matrix of the MVP (Model-View-Projection Matrix) of the decal model to obtain the target coordinate vector of the decal target point.

[0079] It can be understood that the target coordinate vector is a four-dimensional coordinate vector of the decal target point in the model space of the decal model.

[0080] Optionally, the electronic device may convert the four-dimensional coordinate vector in the NDC space into a four-dimensional coordinate vector in the model space of the decal model by multiplying the four-dimensional coordinate vector by the MVP inverse matrix of the decal model.

[0081] In this embodiment, if the x value, y value, and z value of the target coordinate vector meet preset conditions, it can be determined that the decal target point is located in the model space of the decal model.

[0082] Optionally, the preset condition can be determined according to the model characteristics of the model to be decaled.

[0083] It can be understood that, since the model features of different models to be decaled may be different, different preset conditions may be set for the models to be decaled with different model features.

[0084] In a possible implementation, if the model to be decaled is a cube, the preset condition may be that the absolute values ​​of the x, y and z components of the target coordinate vector do not exceed half of the side length of the model to be decaled.

[0085] For example, if the model to be decaled is a cube with a side length of 1, the preset condition may be that the absolute values ​​of the x-value, y-value, and z-value components of the target coordinate vector do not exceed 0.5.

[0086] Next, a possible implementation method is provided for how to perform three-dimensional texture sampling on the decal model, obtain multiple texture colors, and calculate the target color based on the normal coordinates and multiple texture colors.

[0087] Specifically, in Figure 2 On the basis of Figure 3 For another schematic diagram of the decal method provided in the embodiment of the present application, please refer to Figure 3 , the above step S21 can be implemented by the following steps:

[0088] Step S21 - 1 , performing three-dimensional texture sampling on the decal model to obtain a first texture color of the decal model in the xz plane, a second texture color in the zy plane, and a third texture color in the xy plane.

[0089] Optionally, the electronic device may perform three-dimensional texture sampling on the decal model according to an xz plane, a zy plane, and an xy plane, respectively, so as to obtain a first texture color, a second texture color, and a third texture color.

[0090] Step S21 - 2 , calculating the target color according to the normal coordinates, the first texture color, the second texture color, the third texture color and a preset formula.

[0091] Optionally, the preset formula may be used to perform weighted mixing on the first texture color, the second texture color, and the third texture color according to the normal coordinates, thereby obtaining a target color.

[0092] In a possible implementation, the preset formula is represented as follows:

[0093]

[0094] Among them, C represents the target color, C 1 Characterize the first texture color, C 2 Characterize the second texture color, C 3 Characterizes the third texture color, n x Characterizes the normal x-axis coordinate, n y Represents the normal y-axis coordinate, n z Represents the normal z-axis coordinate.

[0095] In order to perform the corresponding steps in the above embodiments and various possible methods, a method for implementing a decal device is given below. Optionally, the decal device can adopt the above Figure 1 For further information, please refer to Figure 4 , Figure 4 This is a functional module diagram of a decal device provided in an embodiment of the present application. It should be noted that the basic principle and technical effects of the decal device provided in this embodiment are the same as those of the above embodiments. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiments. The decal device includes: a calculation module 200 and a decal module 210.

[0096] The calculation module 200 is used to obtain a decal model and, when it is determined that the decal model is to be decaled, calculate the normal coordinates of the decal target point in the decal model.

[0097] It can be understood that the calculation module 200 can also be used to execute the above step S20.

[0098] The calculation module 200 is also used to perform three-dimensional texture sampling on the decal model to obtain multiple texture colors, and calculate the target color according to the normal coordinates and the multiple texture colors.

[0099] It can be understood that the calculation module 200 can also be used to execute the above step S21.

[0100] The decal module 210 is used to render the texture of the decal model onto the decal target point according to the target color.

[0101] It is understandable that the decal module 210 can also be used to execute the above step S22.

[0102] Optionally, the calculation module 200 is also used to determine the coordinate vector corresponding to the decal target point based on the position coordinates of the decal model and a preset depth map, and determine whether the decal target point is located in the model space of the decal model based on the coordinate vector; if the decal target point is located in the model space of the decal model, it is determined to decal the decal model.

[0103] Optionally, the calculation module 200 is also used to determine the depth value corresponding to the decal target point based on the two-dimensional coordinates of the decal model and a preset depth map; determine the four-dimensional coordinate vector corresponding to the decal target point based on the two-dimensional coordinates of the decal model, the depth value of the decal target point and a preset perspective value.

[0104] Optionally, the calculation module 200 is also used to multiply the four-dimensional coordinate vector by the MVP inverse matrix of the decal model to obtain a target coordinate vector of the decal target point; the target coordinate vector is the four-dimensional coordinate vector of the decal target point in the model space of the decal model; if the x value, y value and z value of the target coordinate vector meet preset conditions, it is determined that the decal target point is located in the model space of the decal model.

[0105] Optionally, the calculation module 200 is also used to perform three-dimensional texture sampling on the decal model to obtain the first texture color of the decal model in the xz plane, the second texture color in the zy plane, and the third texture color in the xy plane; and calculate the target color according to the normal coordinates, the first texture color, the second texture color, the third texture color and a preset formula.

[0106] It can be understood that the calculation module 200 can also be used to execute the above steps S21 - 1 to S21 - 2.

[0107] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory shown in the figure or solidified in the operating system (OS) of the electronic device, and can be Figure 1 Meanwhile, the data and program codes required for executing the above modules can be stored in the memory.

[0108] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the decal method provided in the embodiment of the present application can be implemented.

[0109] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0110] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0111] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0112] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A decal method, characterized in that: The method comprises: Acquire a decal model, and when determining to apply decals to the decal model, calculate the normal coordinates of a decal target point in the decal model; Performing three-dimensional texture sampling on the decal model to obtain a plurality of texture colors, and calculating a target color according to the normal coordinates and the plurality of texture colors; The texture of the decal model is rendered onto the decal target point according to the target color.

2. The method according to claim 1, characterized in that After obtaining the decal model, the method further includes: Determining a coordinate vector corresponding to the decal target point according to the position coordinates of the decal model and a preset depth map, and determining whether the decal target point is located in the model space of the decal model according to the coordinate vector; If the decal target point is located in the model space of the decal model, it is determined to perform decaling on the decal model.

3. The method according to claim 2, characterized in that The position coordinates are two-dimensional coordinates of the decal model, and the coordinate vector is a four-dimensional coordinate vector; determining the coordinate vector corresponding to the decal target point according to the position coordinates of the decal model and a preset depth map includes: Determining a depth value corresponding to the decal target point according to the two-dimensional coordinates of the decal model and a preset depth map; A four-dimensional coordinate vector corresponding to the decal target point is determined according to the two-dimensional coordinates of the decal model, the depth value of the decal target point, and a preset perspective value.

4. The method according to claim 3, characterized in that The determining, according to the coordinate vector, whether the decal target point is located in the model space of the decal model comprises: Multiplying the four-dimensional coordinate vector by the MVP inverse matrix of the decal model to obtain a target coordinate vector of the decal target point; the target coordinate vector is a four-dimensional coordinate vector of the decal target point in the model space of the decal model; If the x value, y value and z value of the target coordinate vector meet preset conditions, it is determined that the decal target point is located in the model space of the decal model.

5. The method according to claim 1, characterized in that The three-dimensional texture sampling is performed on the decal model to obtain a plurality of texture colors, and a target color is calculated according to the normal coordinates and the plurality of texture colors, including: Performing three-dimensional texture sampling on the decal model to obtain a first texture color of the decal model in an xz plane, a second texture color in a zy plane, and a third texture color in an xy plane; The target color is calculated according to the normal coordinates, the first texture color, the second texture color, the third texture color and a preset formula.

6. The method according to claim 5, characterized in that The preset formula is characterized as: C=C1×n y / (n x +n y +n z )+C2×n x / (n x +n y +n z )+C3 ×n z / (n x +n y +n z ) Wherein, C represents the target color, C1 represents the first texture color, C2 represents the second texture color, C3 represents the third texture color, n x Characterizes the normal x-axis coordinate, n y Represents the normal y-axis coordinate, n z Represents the normal z-axis coordinate.

7. A decal device, characterized in that: The device comprises: A calculation module, used for obtaining a decal model, and when determining to decal the decal model, calculating the normal coordinates of a decal target point in the decal model; The calculation module is further used to perform three-dimensional texture sampling on the decal model to obtain multiple texture colors, and calculate the target color according to the normal coordinates and the multiple texture colors; A decal module is used to render the texture of the decal model onto the decal target point according to the target color.

8. The device according to claim 7, characterized in that The calculation module is also used to determine the coordinate vector corresponding to the decal target point according to the position coordinates of the decal model and a preset depth map, and determine whether the decal target point is located in the model space of the decal model according to the coordinate vector; if the decal target point is located in the model space of the decal model, it is determined to decal the decal model.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the method according to any one of claims 1 to 6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.