Method, device and electronic equipment for rendering decal effect
Patent Information
- Application Number
- CN202310136289.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-07
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2043-02-07
AI Technical Summary
当虚拟场景中的贴花量较多时,场景中会增加较多数量的骨骼,计算骨骼的相关数据增加了运算资源和系统性能的消耗,甚至导致系统运行卡顿或闪退,影响了系统运行的稳定性
上述贴画效果的渲染方法、装置和电子设备,获取目标模型和代理模型,从目标模型上确定目标表面区域;其中,目标模型和代理模型相交,目标表面区域位于目标模型的表面,且目标表面区域位于代理模型的内部;获取缩放距离值和代理模型的指定顶点数值,基于缩放距离值和指定顶点数值,控制代理模型上的模型顶点进行顶点偏移处理;其中,代理模型中的指定模型区域中,模型顶点的指定顶点数值沿着指定维度逐渐变化;顶点偏移后的指定模型区域被缩放;基于代理模型的模型空间中,目标表面区域中的模型顶点的模型空间坐标,生成拉伸参数;基于拉伸参数生成预设贴花贴图的UV采样坐标;基于UV采样坐标将预设贴花贴图渲染到顶点偏移后的代理模型,得到最终贴花效果;其中,相对于预设贴花贴图的原始贴花效果,最终贴花效果中的局部贴花区域被缩放;最终贴花效果显示在目标模型上的目标表面区域。
Smart Images

Figure CN116245991B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of decal technology, and in particular to a method, apparatus and electronic device for rendering decal effects. Background Technology
[0002] Decals are a common texturing technique used in virtual reality engines to draw images onto the surface of virtual models. To achieve localized stretching of decals, related technologies bind skeletons to the virtual model, scaling the skeletons to stretch the decals locally. When there are many decals in a virtual scene, a large number of skeletons are added to the scene. Calculating the relevant skeleton data increases the consumption of computing resources and system performance, and may even cause system lag or crashes, affecting system stability. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide a method, apparatus and electronic device for rendering decal effects, so as to achieve the effect of local stretching of decals with low computing resources and system performance consumption.
[0004] In a first aspect, embodiments of the present invention provide a method for rendering a decal effect. The method includes: acquiring a target model and a proxy model, and determining a target surface region from the target model; wherein the target model and the proxy model intersect, the target surface region is located on the surface of the target model, and the target surface region is located inside the proxy model; acquiring a scaling distance value and a specified vertex value of the proxy model, and controlling the model vertices on the proxy model to perform vertex offset processing based on the scaling distance value and the specified vertex value; wherein, in the specified model region of the proxy model, the specified vertex value of the model vertex gradually changes along a specified dimension; the specified model region after vertex offset is scaled; generating stretching parameters based on the model space coordinates of the model vertices in the target surface region in the model space of the proxy model; generating UV sampling coordinates of a preset decal texture based on the stretching parameters; rendering the preset decal texture onto the proxy model after vertex offset based on the UV sampling coordinates to obtain the final decal effect; wherein, relative to the original decal effect of the preset decal texture, the local decal region in the final decal effect is scaled; the final decal effect is displayed on the target surface region of the target model.
[0005] Secondly, embodiments of the present invention also provide a rendering apparatus for a decal effect, the apparatus comprising: a first determining module, configured to acquire a target model and a proxy model, and determine a target surface region from the target model; wherein the target model and the proxy model intersect, the target surface region is located on the surface of the target model, and the target surface region is located inside the proxy model; a first controlling module, configured to acquire a scaling distance value and a specified vertex value of the proxy model, and control the model vertices on the proxy model to perform vertex offset processing based on the scaling distance value and the specified vertex value; wherein, in the specified model region of the proxy model, the specified vertex value of the model vertex gradually changes along a specified dimension; the specified model region after vertex offset is scaled; a first generating module, configured to generate stretching parameters based on the model space coordinates of the model vertices in the target surface region in the model space of the proxy model; and generate UV sampling coordinates of a preset decal texture based on the stretching parameters; a first rendering module, configured to render the preset decal texture onto the proxy model after vertex offset based on the UV sampling coordinates to obtain a final decal effect; wherein, relative to the original decal effect of the preset decal texture, the local decal region in the final decal effect is scaled; the final decal effect is displayed on the target surface region of the target model.
[0006] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-mentioned decal effect rendering method.
[0007] Fourthly, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the above-mentioned decal effect rendering method.
[0008] The embodiments of the present invention bring the following beneficial effects: The above-mentioned method, apparatus, and electronic device for rendering decal effects involve: acquiring a target model and a proxy model; determining a target surface region from the target model; wherein the target model and the proxy model intersect, the target surface region is located on the surface of the target model, and the target surface region is located inside the proxy model; acquiring scaling distance values and specified vertex values of the proxy model; and controlling the model vertices on the proxy model to perform vertex offset processing based on the scaling distance values and specified vertex values; wherein the specified vertex values of the model vertices in the specified model region of the proxy model gradually change along a specified dimension; the specified model region after vertex offset is scaled; generating stretching parameters based on the model space coordinates of the model vertices in the target surface region in the model space of the proxy model; generating UV sampling coordinates of a preset decal texture based on the stretching parameters; rendering the preset decal texture onto the proxy model after vertex offset based on the UV sampling coordinates to obtain the final decal effect; wherein, relative to the original decal effect of the preset decal texture, the local decal region in the final decal effect is scaled; and the final decal effect is displayed on the target surface region of the target model.
[0009] In this method, a proxy model is first created for the virtual model, and a target surface region is defined on the target model. The vertex values of the specified model region of the proxy model vary along a specified dimension. Based on the vertex values and scaling distance values, the model vertices of the proxy model are offset. After offsetting, a portion of the proxy model is scaled. Then, using the model space coordinates of the model vertices in the target surface region, the UV sampling coordinates of the decal texture are calculated. Based on these UV sampling coordinates, the decal texture is rendered onto the proxy model, resulting in the decal effect displayed on the target model. Using this method, there is no need to set a skeleton for the decal. By controlling the offset of model vertices and texture sampling, local stretching of the texture can be achieved, reducing the consumption of computing resources and system performance, and improving the stability of system operation.
[0010] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0012] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0013] Figure 1 A flowchart illustrating a method for rendering a decal effect according to an embodiment of the present invention; Figure 2 A schematic diagram of a target surface region provided in an embodiment of the present invention; Figure 3 A schematic diagram of a UV projection texture provided in an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the effect of locally stretching a decal image according to an embodiment of the present invention; Figure 5 A schematic diagram of the structure of a decal effect rendering device provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0015] First, the technical terms used in this embodiment will be explained.
[0016] 1. Decal technique Decals are a common type of texture mapping technique in game engines, which typically involves drawing images onto the surface of another object.
[0017] 2. Nine-square grid pattern Nine-grid texture is a 2D texture technique designed to handle the stretching effect of different parts of an image.
[0018] 3. DCC software DCC stands for Digital Content Creation (or Creating), which is a software for generating digital content. It generally refers to all-in-one 3D digital software such as Maya, 3DMax, and Blender.
[0019] 4. The Saturate() function The Saturate() function restricts the range of values to 0-1, setting values less than 0 to 0 and values greater than 1 to 1.
[0020] 5. The Sign(x) function The Sign(x) function is a numerical operation. If x > 0, sign(x) = 1; if x < 0, sign(x) = -1; if x = 0, sign(x) = 0.
[0021] Currently, decal technology in virtual engines can draw images onto the surface of virtual models, but it cannot achieve the effect of stretching different parts of the decal texture at different ratios. Related technologies bind skeletons to the virtual model and then scale the skeletons to achieve local stretching of the decal. However, when a large number of decals are used in a virtual scene, a large number of skeletons exist in the virtual scene. Even if some decals on the virtual model do not require stretching, the skeleton data bound to the virtual model still exists in the virtual scene. For decals that require local scaling, it is necessary to process the position, scaling, and rotation information of each skeleton point. Since skeleton calculations are usually performed on the CPU (Central Processing Unit), this results in a large CPU load, increasing the consumption of computing resources and system performance, and may even cause system lag or crashes, affecting system stability.
[0022] In addition, the nine-grid texture technology can also handle the stretching effect of images. However, this technology is generally used for UI interfaces, that is, it can only be used on two-dimensional planes and is not suitable for three-dimensional models.
[0023] Based on the above, the present invention provides a method, apparatus and electronic device for rendering decal effects. This technology can be applied to decal rendering scenes, for example, to locally stretch decal textures.
[0024] To facilitate understanding of this embodiment, a method for rendering a decal effect disclosed in this invention will first be described in detail, such as... Figure 1 As shown, the method includes the following steps: Step S102: Obtain the target model and the proxy model, and determine the target surface region from the target model; wherein the target model and the proxy model intersect, the target surface region is located on the surface of the target model, and the target surface region is located inside the proxy model; Decals are a common texturing technique in virtual engines, used to draw images onto the surface of virtual models. In practice, considering that virtual models can be complex or repetitive, a simple 3D mesh model, or proxy model, can be created to replace the virtual model. It's important to note that the proxy model, as the carrier of the decal, has no strict requirements regarding its shape or face count; it can be any shape and face count. Considering system performance, a model with fewer faces can be used as the proxy model, such as a simple cube or cuboid.
[0025] Specifically, the target model and the proxy model are obtained, and the target surface region is determined from the target model. The target model can be any virtual model, and the target surface region is located on the surface of the target model, representing the area on the target model where textures need to be applied. In actual implementation, the target model and the proxy model intersect, and the target surface region is located inside the proxy model.
[0026] For easier understanding, please refer to Figure 2 . Figure 2 In this diagram, a cylinder represents the virtual model, i.e., the target model, and a cuboid represents the proxy model. The cuboid and cylinder intersect; this intersection occurs both on the surface of the cylinder and within the interior of the cuboid. (See reference...) Figure 2 The area marked with a diagonal line is the target surface area mentioned above.
[0027] Step S104: Obtain the scaling distance value and the specified vertex value of the proxy model. Based on the scaling distance value and the specified vertex value, control the model vertices on the proxy model to perform vertex offset processing. In the specified model region in the proxy model, the specified vertex value of the model vertex gradually changes along the specified dimension. The specified model region after vertex offset is scaled. When creating a proxy model, vertex colors can be drawn for that model, used to output a mask for each vertex color. Vertex colors can be divided into four channels: R channel, G channel, B channel, and A channel, which can store different masks. Therefore, the specified vertex values mentioned above can be the R channel values of the vertex colors drawn in the proxy model. The scaling distance value mentioned above is a customizable value used to control the stretching degree of the decal.
[0028] In the vertex shader, vertex offset can be performed, which means controlling the position of vertices in the model to move. Based on the scaling distance value and the specified vertex value of the proxy model, the model vertices in the proxy model are controlled to perform vertex offset processing.
[0029] It should be noted that the proxy model can be divided into multiple regions along a specified dimension. During vertex offset processing, within a specified model region of the proxy model, the values of specified vertex vertices in that region can gradually change along that specified dimension. For example, the values of specified vertex vertices can gradually increase or decrease, thereby controlling the scaling of the specified model region after vertex offset. Here, the specified model region can be an intermediate model region of the proxy model; the specified dimension can be a vertical dimension, a horizontal dimension, or other options.
[0030] Step S106: Based on the model space coordinates of the model vertices in the target surface region in the model space of the proxy model, generate stretching parameters; generate UV sampling coordinates of the preset decal texture based on the stretching parameters; Specifically, the aforementioned target surface region is located on the surface of the target model. The coordinates of the model vertices within this region in model space can be obtained. Then, stretching parameters are generated based on these model space coordinates. In practice, multiple stretching parameters can be generated based on different coordinate components in the model space. Finally, the UV sampling coordinates of a preset decal texture are calculated based on these stretching parameters.
[0031] Step S108: Render the preset decal texture onto the proxy model after vertex offset based on the UV sampling coordinates to obtain the final decal effect; wherein, relative to the original decal effect of the preset decal texture, the local decal area in the final decal effect is scaled; the final decal effect is displayed on the target surface area on the target model.
[0032] The aforementioned decal texture can be a non-repeating image or texture with a specified projection. The initial decal effect refers to rendering a preset decal image onto a proxy model that has not been scaled, based on the location of the target surface area. It should be noted that although the decal effect is rendered in the proxy model, the proxy model is not displayed during actual display; only the decal effect is shown. Visually, the decal effect appears to be displayed on the target surface area of the target model.
[0033] In this step, after obtaining the UV sampling coordinates, the preset decal texture is rendered onto the proxy model after vertex offset using the UV sampling coordinates. This results in a scalable decal effect on the target surface area of the target model. As you can understand, since the specified model area in the proxy model is scaled, in the final decal effect, the local decal will also be scaled relative to the original decal effect of the preset decal texture. Therefore, the final effect of scaling the decal texture can be achieved.
[0034] The above-described decal effect rendering method, apparatus, and electronic device involve: acquiring a target model and a proxy model; determining a target surface region from the target model; wherein the target model and the proxy model intersect, the target surface region is located on the surface of the target model, and the target surface region is located inside the proxy model; acquiring scaling distance values and specified vertex values of the proxy model; controlling the model vertices on the proxy model to perform vertex offset processing based on the scaling distance values and specified vertex values; wherein, in the specified model region of the proxy model, the specified vertex values of the model vertices gradually change along a specified dimension; the specified model region after vertex offset is scaled; generating stretching parameters based on the model space coordinates of the model vertices in the target surface region in the model space of the proxy model; generating UV sampling coordinates of a preset decal texture based on the stretching parameters; rendering the preset decal texture onto the proxy model after vertex offset based on the UV sampling coordinates to obtain the final decal effect; wherein, relative to the original decal effect of the preset decal texture, the local decal region in the final decal effect is scaled; the final decal effect is displayed on the target surface region of the target model.
[0035] In this method, a proxy model is first created for the virtual model, and a target surface region is defined on the target model. The vertex values of the specified model region of the proxy model vary along a specified dimension. Based on the vertex values and scaling distance values, the model vertices of the proxy model are offset. After offsetting, a portion of the proxy model is scaled. Then, using the model space coordinates of the model vertices in the target surface region, the UV sampling coordinates of the decal texture are calculated. Based on these UV sampling coordinates, the decal texture is rendered onto the proxy model, resulting in the decal effect displayed on the target model. Using this method, there is no need to set a skeleton for the decal. By controlling the offset of model vertices and texture sampling, local stretching of the texture can be achieved, reducing the consumption of computing resources and system performance, and improving the stability of system operation.
[0036] The following examples provide a specific implementation of scaling a specified region of the proxy model.
[0037] In one approach, the proxy model is divided into a first edge model region, an intermediate model region, and a second edge model region along a specified dimension; the specified model region is the intermediate model region; the specified vertex values of the model vertices in the first edge model region are first specified values; the specified vertex values of the model vertices in the second edge model region are second specified values; the specified vertex values of the model vertices in the intermediate model region are values between the first and second specified values; along the specified dimension, the specified vertex values of the model vertices in the intermediate model region gradually increase or gradually decrease.
[0038] In an optional implementation, the specified dimension can be a vertical dimension. The proxy model can be divided into three regions along the vertical direction: a first edge model region, a middle model region, and a second edge model region. The specified model region is the middle model region. The specified vertex values of the model vertices in the first edge model region can be set to a first specified value, and the specified vertex values of the model vertices in the second edge model region can be set to a second specified value. It should be noted that the first and second specified values are different. The specified vertex values of the model vertices in the middle model region are located between the first and second specified values. Furthermore, in the vertical direction, the value of the specified vertex can gradually increase or decrease depending on the position of the model vertex.
[0039] Furthermore, the process of controlling the scaling of the specified intermediate model region can be understood as follows: based on the specified values of the model vertices in the first edge model region and the scaling distance value, the model vertices in the first edge model region are moved a certain distance. It is worth noting that the specified values of the model vertices in the first edge region model are all the same value, i.e., the aforementioned first specified value. Therefore, when controlling the movement of the model vertices in the first edge model, the distance the model vertices move is the same, and thus, the first edge model region is not stretched. Similarly, for the same reason, the second edge model region is also not stretched. The specified values of the vertices in the intermediate model region of the proxy model are values between the first and second specified values, and can gradually increase or decrease along a specified dimension. Therefore, after vertex offset processing, the intermediate model region is scaled.
[0040] The following embodiments provide a specific implementation of the proxy model partitioning process.
[0041] In one specific implementation, a UV map of the proxy model is obtained, and the UV map is projected along a specified viewpoint to obtain a UV projection map; wherein, the UV projection map includes a specified dimension and a first dimension perpendicular to the specified dimension; the dimension corresponding to the specified viewpoint is perpendicular to the UV projection map; the UV projection map is divided into a first map region, an intermediate map region, and a second map region; wherein, the edges of the first map region and the intermediate map region have first coordinate values in the specified dimension; the edges of the intermediate map region and the second map region have second coordinate values in the specified dimension; the sum of the first coordinate values and the second coordinate values is the length value of the UV projection map in the specified dimension; the proxy model is divided according to the first map region, the intermediate map region, and the second map region to obtain a first edge model region, an intermediate model region, and a second edge model region.
[0042] In practice, firstly, the UV map of the proxy model is obtained. This UV map is a planar representation of the 3D model surface used to wrap the texture. Then, the UV map can be projected along a specified viewpoint to obtain the UV projection map. This specified viewpoint can be a view from directly above, from the left, from the right, etc. The UV projection map is a two-dimensional plane; therefore, it can include a specified dimension and a first dimension perpendicular to that specified dimension. For example, when the specified dimension is a vertical dimension, the first dimension is a horizontal dimension. It should be noted that the dimension corresponding to the specified viewpoint is perpendicular to the UV projection map. For example, if the specified viewpoint is a view from directly above, and the dimension corresponding to this viewpoint is vertical, then the UV projection map is a horizontal plane.
[0043] Secondly, the aforementioned UV projection map is divided into three regions along a specified dimension. Taking the vertical dimension as an example, after dividing the UV projection map vertically, a first mapping region, a middle mapping region, and a second mapping region are obtained. The first mapping region and the middle mapping region are adjacent; therefore, the vertical coordinate value corresponding to the edge of the first and middle mapping regions, i.e., the position connecting the first and middle mapping regions, can be the first coordinate value. Similarly, the middle and second mapping regions are adjacent; therefore, the vertical coordinate value corresponding to the edge of the middle and second mapping regions, i.e., the position connecting the middle and second mapping regions, can be the second coordinate value. It is important to note that in this embodiment, the sum of the first and second coordinate values must equal the length of the UV projection map along the specified dimension; that is, the sum of the first and second coordinate values must equal the vertical length of the UV projection map. In practice, this length value can be 1.
[0044] Figure 3 As an example, where U is the horizontal coordinate axis and V is the vertical coordinate axis, the UV projection map is divided into a first mapping region, a middle mapping region, and a second mapping region in the vertical direction, and the length value of the UV projection map in the vertical direction is 1. In this embodiment, the sum of the first coordinate value and the second coordinate value is the aforementioned length value, which is 1. For example, if the first coordinate value is 0.4, then the second coordinate value is 0.6; if the first coordinate value is 0.04, then the second coordinate value is 0.96.
[0045] Finally, based on the mapping relationship of UV projection maps, the proxy model can also be divided into three regions. Specifically, the proxy model can be divided into a first map region, a middle map region, and a second map region, resulting in a first edge model region, a middle model region, and a second edge model region.
[0046] By adopting this step, it can be ensured that, from a specified perspective, the three regions of the proxy model correspond one-to-one with the three regions of the UV projection map. That is, the first map region corresponds to the first edge model region, the middle map region corresponds to the middle model region, and the second map region corresponds to the second edge model region.
[0047] Furthermore, a first specified value is stored in the model vertices of the first edge model region, and a second specified value is stored in the model vertices of the second edge model region. For model vertices in the middle model region, values are stored in the model vertices based on their distances from the first and second edge model regions, respectively. Specifically, the closer a model vertex is to the first edge model region, the closer the value stored in the model vertex is to the first specified value; the closer a model vertex is to the second edge model region, the closer the value stored in the model vertex is to the second specified value.
[0048] Specifically, a first specified value (which can be 1) is stored in the model vertices of the first edge model region of the proxy model, and a second specified value (which can be 0) is stored in the model vertices of the second edge model region of the proxy model. Values are also stored in the model vertices of the intermediate model region, and these values are between the first and second specified values, i.e., between 0 and 1. The specific value can be determined based on the distance between the model vertex and the first and second edge model regions.
[0049] For example, among the model vertices in the middle model region, the model vertex closer to the first edge model region will have a stored value that is closer to the first specified value; the model vertex closer to the second edge model region will have a stored value that is closer to the second specified value.
[0050] The following embodiment provides a specific implementation method for obtaining the initial decal effect.
[0051] Specifically, based on the location of the target surface area, a preset decal texture is rendered in the proxy model to obtain the initial decal effect; wherein, the initial decal effect is displayed in the target surface area.
[0052] In other words, based on the location of the target surface area, the preset decal image is rendered onto the unscaled proxy model of the specified model area to obtain the initial decal effect, which is displayed on the target surface area of the target model.
[0053] In this method, it is necessary to obtain the scene depth information corresponding to the target surface area, and determine the world space coordinates of the model vertices in the target surface area based on the scene depth information; transform the world space coordinates into the model space of the proxy model through a preset transformation matrix to obtain the model space coordinates of the model vertices in the target surface area; and render a preset decal texture in the proxy model based on the model space coordinates to obtain the initial decal effect.
[0054] Specifically, the scene depth information corresponding to the target surface region can be obtained in the fragment shader. This target surface region is located on the surface of the target model and can include multiple vertices. The aforementioned scene depth information can include the scene depth of each vertex on the target surface region. Furthermore, for virtual models, each virtual model has its own model space. When creating a virtual model, a three-dimensional coordinate system can be established with a vertex on the model as the origin; this three-dimensional coordinate system is the model space coordinate system. World space is the three-dimensional virtual space where multiple virtual models reside, corresponding to a world space coordinate system. In world space, all objects share an absolute position, which can be expressed using world space coordinates.
[0055] In practice, model space coordinates can be converted to world space coordinates. Therefore, after obtaining the scene depth information corresponding to the target surface region, the world space coordinates of the model vertices in the target surface region can be calculated using this scene depth information and a transformation matrix. Then, using a preset matrix, the world space coordinates can be converted to the model space of the proxy model to obtain the model space coordinates of the model vertices in the target surface region. Finally, the preset decal texture is rendered into the proxy model to obtain the initial decal effect.
[0056] The following embodiments provide a specific implementation method for controlling the vertex offset of a model.
[0057] Multiply the scaling distance value by the specified vertex value stored on the model vertex in the proxy model to obtain the first multiplication result; add the first multiplication result to the coordinate component of the specified dimension in the model space coordinates of the model vertex to obtain the offset value of the model vertex in the specified dimension; control the model vertex to offset in the specified dimension based on the offset value.
[0058] The scaling distance value mentioned above can be represented by MoveDistance, which is a customizable value that controls the stretching degree of the decal. The specified vertex value mentioned above can be the R-channel value of the vertex color drawn in the proxy model; specifically, the specified vertex value can be 1. The specified dimension mentioned above can be a vertical dimension or a horizontal dimension, etc. In this embodiment, the specified dimension is taken as an example for explanation.
[0059] In practice, for a model vertex on the proxy model, the scaling distance value can be multiplied by the specified vertex value stored on the model vertex to obtain the first multiplication result. Then, this first multiplication result is added to the vertical coordinate component of the model vertex in the model space coordinates of the proxy model to obtain the vertical offset value of the model vertex. Finally, this offset value can be used to control the vertical offset of the model vertex.
[0060] In this step, the vertical offset value can be controlled by customizing the distance scaling value. Furthermore, since the proxy model is divided into three regions, and the vertices of the first edge model region store the first specified value, while the vertices of the second edge model region store the second specified value, it can be ensured that the movement distance of the first and second edge model regions of the proxy model is the same.
[0061] The following example provides a specific implementation method for generating tensile parameters.
[0062] Obtain the first coordinate component and the second coordinate component from the model space coordinates; wherein the first coordinate component is the coordinate component in the specified dimension and the second coordinate component is the coordinate component in the vertical dimension of the specified dimension; add the first coordinate component and the second coordinate component to the first specified value to obtain the intermediate result, and limit the intermediate result to the specified value range based on the preset range limiting function to obtain the first stretching parameter; add the first specified value to the first coordinate component to obtain the second stretching parameter.
[0063] Taking the vertical dimension as an example, the first coordinate component mentioned above is the coordinate component in the vertical direction, and the second coordinate component is the coordinate component in the horizontal direction. Specifically, the vertical and horizontal coordinate components are obtained from the model space coordinates. Then, a first specified value is added to each of the vertical and horizontal coordinate components to obtain the intermediate result. The first specified value can be half the length and width of the proxy model. For example, if the length and width of the proxy model are both 1, then the first specified value is 0.5.
[0064] Furthermore, the intermediate results can be restricted to a specified numerical range using a preset range constraint function to obtain a first stretching parameter, which can be represented by `texcoord`. Specifically, the preset range constraint function can be the `saturate()` function, which can restrict the intermediate results to between 0 and 1. Then, by adding the specified first value to the first coordinate component, a second stretching parameter can be obtained, which can be represented by `texYValue`. It should be noted that the first stretching parameter is a two-dimensional variable, and the second stretching parameter is a one-dimensional variable.
[0065] In this step, by adding a first specified value to the first coordinate component and the second coordinate component respectively, and using a preset range limiting function, the origin of the proxy model can be moved to correspond with the UV map of the proxy model.
[0066] The following embodiment provides a specific implementation method for obtaining the UV sampling coordinate range corresponding to the second edge model region.
[0067] Determine the first difference between the second specified value and the second stretching parameter in the stretching parameters, and limit the first difference to a specified value range based on a preset range limiting function to obtain a first intermediate range value; determine the second difference between the third specified value and the first intermediate range value; obtain the first coordinate range of the second mapping region in the UV projection map of the proxy model in a specified dimension; multiply the second difference by the first coordinate range to obtain a second multiplication result; multiply the second multiplication result by the sign function result of the first intermediate range value to obtain the UV sampling coordinate range corresponding to the second edge model region.
[0068] Specifically, a first difference is determined between the second specified value and the second stretching parameter in the stretching parameters. Then, a preset range limiting function is used to restrict the first difference within a specified numerical range to obtain a first intermediate range value. In one specific implementation, the second specified value can actually be 1, the preset range limiting function can be the saturate() function, and the first intermediate range value can be represented by inDownBox. Then, a second difference is determined between the third specified value and the first intermediate range value, wherein the third specified value can be the same as the second specified value.
[0069] Furthermore, based on the second coordinate value of the edge of the second mapping region in a specified dimension in the UV projection map of the proxy model, the first coordinate range of the second mapping region in a specified dimension can be determined. This first coordinate range of the second mapping region in a specified dimension can be denoted as UVPercent. Then, multiplying the above second difference with the first coordinate range yields a second multiplication result. Multiplying this second multiplication result by the sign function result of the first intermediate range value gives the UV sampling coordinate range corresponding to the second edge model region. This UV sampling coordinate range corresponding to the second edge model region can be represented by inDownBoxV. It should be noted that the above sign function can be the sign(x) function. If x>0, sign(x)=1; if x<0, sign(x)=-1; if x=0, sign(x)=0.
[0070] The following embodiment provides a specific implementation method for obtaining the UV sampling coordinate range corresponding to the first edge model region.
[0071] Determine the third difference between the second stretching parameter and the scaling distance value in the stretching parameters, and limit the third difference to a specified numerical range based on a preset range constraint function to obtain the second intermediate range value; obtain the first coordinate range of the second mapping region in the UV projection map of the proxy model in a specified dimension; multiply the second intermediate range value by the first coordinate range to obtain the third multiplication result; obtain the fourth multiplication result of the sign function result of the fourth specified value, the difference between the first coordinate range and the second intermediate range value; add the third multiplication result and the fourth multiplication result to obtain the UV sampling coordinate range corresponding to the first edge model region.
[0072] Specifically, the third difference between the second stretching parameter and the scaling distance value is determined, and a preset range constraint function is used to restrict the third difference within a specified numerical range to obtain a second intermediate range value. The preset range constraint function can be the `saturate()` function, and the second intermediate range value can be represented by `inUpBox`. Then, based on the second coordinate value of the edge of the second mapping region in the specified dimension of the UV projection map of the proxy model, the first coordinate range of the second mapping region in the specified dimension can be determined.
[0073] Furthermore, multiplying the second intermediate range value by the first coordinate range yields the third multiplication result. Next, a fourth specified value is obtained, and the difference between this fourth specified value and the first coordinate range is calculated. This difference is then multiplied by the sign function of the second intermediate range value to obtain the fourth multiplication result. It should be noted that the fourth specified value can be the same as the second specified value, i.e., both can be 1. Finally, adding the third and fourth multiplication results gives the UV sampling coordinate range corresponding to the first edge model region, which can be represented by `inUpBoxV`.
[0074] The following embodiment provides a specific implementation method for obtaining the UV sampling coordinate range corresponding to the intermediate model region.
[0075] Determine the fourth difference between the second stretching parameter and the fifth specified value in the stretching parameters; determine the fifth difference between the scaling distance value and the sixth specified value; calculate the ratio of the fourth difference to the fifth difference; limit the above ratio to a specified value range based on a preset range constraint function to obtain the third intermediate range value; obtain the first coordinate range of the second mapping region in the UV projection map of the proxy model in the specified dimension; determine the sixth difference between the seventh specified value and the first coordinate range; use the third intermediate range value as a weight parameter to interpolate the first coordinate range and the sixth difference to obtain the interpolation result; determine the sign function result of the sum of the first intermediate range value and the second intermediate range value; determine the seventh difference between the eighth specified value and the sign function result; multiply the interpolation result by the seventh difference to obtain the UV sampling coordinate range corresponding to the intermediate model region.
[0076] Specifically, the fourth difference between the second stretching parameter and the fifth specified value, and the fifth difference between the scaling distance value and the sixth specified value, are determined. In actual implementation, the fifth and sixth specified values can be the same as the second specified value, i.e., both are 1. After calculating the fourth and fifth differences, the ratio of the fourth and fifth differences is further calculated, and then a preset range limiting function is used to restrict this ratio within a specified numerical range to obtain the third intermediate range value. The preset range limiting function can be the `saturate()` function, and the third intermediate range value can be represented by `inMiddleBox`.
[0077] Furthermore, based on the second coordinate value of the edge of the second mapping region in the specified dimension in the UV projection map of the proxy model, the first coordinate range of the second mapping region in the specified dimension can be determined. Then, the sixth difference between the seventh specified value and the first coordinate range can be determined. This seventh specified value can also be the same as the second specified value, i.e., the seventh specified value is also 1.
[0078] Furthermore, the third intermediate range value is used as a weight parameter to perform interpolation processing on the first coordinate range and the sixth difference value. Specifically, the lerp() function can be used for interpolation processing, that is, by calculating lerp(first coordinate range, sixth difference value, third intermediate range value), the interpolation result is obtained.
[0079] Furthermore, the first intermediate range value is added to the second intermediate range value to determine the sign function result of the sum of the first and second intermediate range values. Specifically, this can be determined using `sign(first intermediate range value + second intermediate range value)`. Then, the seventh difference between the eighth specified value and the sign function result can be determined. The eighth specified value can also be the same as the second specified value, i.e., the eighth specified value is 1. Finally, the above interpolation result is multiplied by the seventh difference to obtain the UV sampling coordinate range corresponding to the intermediate model region. This UV sampling coordinate range corresponding to the intermediate model region can be represented by `inMiddleBoxV`.
[0080] The following embodiment provides a specific implementation method for obtaining the final decal effect.
[0081] The UV sampling coordinate ranges corresponding to the first edge model region, the second edge model region, and the middle model region are merged to obtain a merged result. The merged result and the specified coordinate component of the first stretching parameter in the above stretching parameters are determined as the final UV sampling coordinates. The preset decal texture is rendered onto the proxy model using the final UV sampling coordinates to obtain the final decal effect.
[0082] Specifically, the UV sampling coordinate ranges corresponding to the first edge model region, the second edge model region, and the middle model region are merged. In particular, the UV sampling coordinate ranges corresponding to the three regions are added together to obtain the merged result.
[0083] Then, the specified coordinate component of the merged result and the first stretching parameter in the stretching parameters can be determined as the final UV sampling coordinates. Specifically, the specified coordinate component can be the horizontal component; that is, the horizontal component of the merged result and the first stretching parameter in the stretching parameters can be used as the final UV sampling coordinates.
[0084] Finally, the preset decal texture can be sampled using the final UV sampling coordinates mentioned above, and then rendered onto the proxy model to obtain the final decal effect.
[0085] Figure 4 As an example, a diagram showing the effect of scaling a decal image vertically is provided. Figure 4 Taking a cuboid as an example, the proxy model is divided into a first edge model region, a middle model region, and a second edge model region. A target contact surface region exists on the right side of the proxy model. By multiplying the scaled distance value by a first specified value stored at the model vertex in the first edge model region, a first multiplication result is obtained. This first multiplication result is then added to the vertical coordinate component of the model vertex's model space coordinates to obtain the vertical offset value of the model vertex. This controls the model vertices in the first edge model region to offset by the same distance in the vertical direction. The model vertices in the second edge model region are offset in the same way.
[0086] Then, by using the above calculation method to obtain the final UV sampling coordinates, and using these UV sampling coordinates to sample the decal texture, the first edge model area and the second edge model area can be stretched while maintaining a scaling ratio of 1 when the decal texture is scaled by vertex offset in the numerical direction, and the scaling ratio of the middle model area is the offset distance value of the model vertex, thereby achieving a local scaling effect on the decal texture.
[0087] In this embodiment, the UV maps of the proxy model used to render the decal are rearranged and adjusted. The rearranged UV maps in the shader utilize the proxy model, and the UV sampling coordinate range of the decal map is calculated using a new algorithm based on depth information. The final UV sampling coordinates are then used to calculate the final UV sampling coordinates, achieving a local stretching effect on the decal. This method allows for local scaling of the decal map in various directions and can be applied to various special effects. Furthermore, this embodiment offloads computation to the GPU (Graphics Processing Unit), significantly reducing overall performance consumption by leveraging the parallelism of GPU execution.
[0088] For an example of the rendering method for the above decal effect, please refer to [link / reference]. Figure 5 The diagram shows a structural schematic of a decal effect rendering device, which includes: The first determining module 502 is used to acquire the target model and the proxy model, and to determine the target surface region from the target model; wherein the target model and the proxy model intersect, the target surface region is located on the surface of the target model, and the target surface region is located inside the proxy model; The first control module 504 is used to obtain the scaling distance value and the specified vertex value of the proxy model, and control the model vertices on the proxy model to perform vertex offset processing based on the scaling distance value and the specified vertex value; wherein, in the specified model region in the proxy model, the specified vertex value of the model vertex gradually changes along the specified dimension; the specified model region after vertex offset is scaled. The first generation module 506 is used to generate stretching parameters based on the model space coordinates of the model vertices in the target surface region in the model space of the proxy model; and to generate UV sampling coordinates of the preset decal texture based on the stretching parameters. The first rendering module is used to render the preset decal texture to the proxy model after vertex offset based on the UV sampling coordinates to obtain the final decal effect; wherein, compared with the original decal effect of the preset decal texture, the local decal area in the final decal effect is scaled; the final decal effect is displayed on the target surface area on the target model.
[0089] The rendering device for the aforementioned decal effect acquires a target model and a proxy model, and determines a target surface region from the target model. The target model and the proxy model intersect, and the target surface region is located on the surface of the target model and inside the proxy model. It acquires a scaling distance value and specified vertex values of the proxy model, and controls the model vertices on the proxy model to undergo vertex offset processing based on these values. Within the specified model region of the proxy model, the specified vertex values of the model vertices gradually change along a specified dimension. The specified model region after vertex offset is scaled. Based on the model space coordinates of the model vertices in the target surface region within the model space of the proxy model, stretching parameters are generated. Based on the stretching parameters, UV sampling coordinates of a preset decal texture are generated. Based on the UV sampling coordinates, the preset decal texture is rendered onto the proxy model after vertex offset, resulting in the final decal effect. Compared to the original decal effect of the preset decal texture, the local decal region in the final decal effect is scaled. The final decal effect is displayed on the target surface region of the target model.
[0090] In this method, a proxy model is first created for the virtual model, and a target surface region is defined on the target model. The vertex values of the specified model region of the proxy model vary along a specified dimension. Based on the vertex values and scaling distance values, the model vertices of the proxy model are offset. After offsetting, a portion of the proxy model is scaled. Then, using the model space coordinates of the model vertices in the target surface region, the UV sampling coordinates of the decal texture are calculated. Based on these UV sampling coordinates, the decal texture is rendered onto the proxy model, resulting in the decal effect displayed on the target model. Using this method, there is no need to set a skeleton for the decal. By controlling the offset of model vertices and texture sampling, local stretching of the texture can be achieved, reducing the consumption of computing resources and system performance, and improving the stability of system operation.
[0091] The aforementioned proxy model is divided into a first edge model region, an intermediate model region, and a second edge model region along a specified dimension; the specified model region is the intermediate model region; the specified vertex values of the model vertices in the first edge model region are first specified values; the specified vertex values of the model vertices in the second edge model region are second specified values; the specified vertex values of the model vertices in the intermediate model region are values between the first and second specified values; along the specified dimension, the specified vertex values of the model vertices in the intermediate model region gradually increase or gradually decrease.
[0092] The aforementioned proxy model is divided as follows: The UV map of the proxy model is obtained; the UV map is projected along a specified viewpoint to obtain a UV projection map; wherein the UV projection map includes a specified dimension and a first dimension perpendicular to the specified dimension; the dimension corresponding to the specified viewpoint is perpendicular to the UV projection map; the UV projection map is divided into a first mapping region, an intermediate mapping region, and a second mapping region; wherein the edges of the first mapping region and the intermediate mapping region have first coordinate values in the specified dimension; the edges of the intermediate mapping region and the second mapping region have second coordinate values in the specified dimension; the sum of the first coordinate values and the second coordinate values is the length value of the UV projection map in the specified dimension; the proxy model is divided according to the first mapping region, the intermediate mapping region, and the second mapping region to obtain a first edge model region, an intermediate model region, and a second edge model region.
[0093] The aforementioned device further includes a first storage module, used to store the first specified value in the model vertices of the first edge model region and the second specified value in the model vertices of the second edge model region; for the model vertices of the intermediate model region, values are stored in the model vertices based on the distances of the model vertices to the first and second edge model regions respectively; wherein, the closer a model vertex is to the first edge model region, the closer the value stored in the model vertex is to the first specified value; the closer a model vertex is to the second edge model region, the closer the value stored in the model vertex is to the second specified value.
[0094] The aforementioned device also includes a second rendering module, used to render a preset decal texture in a proxy model based on the regional position of the target surface area to obtain an initial decal effect; wherein the initial decal effect is displayed in the target surface area.
[0095] The second rendering module mentioned above is also used to obtain scene depth information corresponding to the target surface area, determine the world space coordinates of the model vertices in the target surface area in world space based on the scene depth information; transform the world space coordinates into the model space of the proxy model through a preset transformation matrix to obtain the model space coordinates of the model vertices in the target surface area; and render a preset decal texture in the proxy model based on the model space coordinates to obtain the initial decal effect.
[0096] The first control module described above is further configured to multiply the scaling distance value and the specified vertex value stored on the model vertex of the proxy model to obtain a first multiplication result; add the first multiplication result to the coordinate component of the specified dimension in the model space coordinates of the model vertex to obtain the offset value of the model vertex in the specified dimension; and control the model vertex to offset in the specified dimension based on the offset value.
[0097] The first generation module is further configured to obtain a first coordinate component and a second coordinate component from the model space coordinates; wherein the first coordinate component is the coordinate component in the specified dimension, and the second coordinate component is the coordinate component in the vertical dimension of the specified dimension; the first coordinate component and the second coordinate component are respectively added to a first specified value to obtain an intermediate result, and the intermediate result is restricted to a specified value range based on a preset range limiting function to obtain a first stretching parameter; the first coordinate component is added to the first specified value to obtain a second stretching parameter.
[0098] The aforementioned first generation module is further configured to determine a first difference between the second specified value and the second stretching parameter in the stretching parameters, and to limit the first difference to a specified numerical range based on a preset range limiting function to obtain a first intermediate range value; determine a second difference between the third specified value and the first intermediate range value; obtain a first coordinate range in a specified dimension of the second mapping region in the UV projection map of the proxy model; multiply the second difference by the first coordinate range to obtain a second multiplication result; and multiply the second multiplication result by the sign function result of the first intermediate range value to obtain the UV sampling coordinate range corresponding to the second edge model region.
[0099] The aforementioned first generation module is further configured to determine the third difference between the second stretching parameter and the scaling distance value in the stretching parameters, and limit the third difference to a specified numerical range based on a preset range constraint function to obtain a second intermediate range value; obtain the first coordinate range of the second mapping region in the UV projection map of the proxy model in a specified dimension; multiply the second intermediate range value by the first coordinate range to obtain a third multiplication result; obtain the fourth multiplication result of the sign function result of the fourth specified value and the difference between the first coordinate range and the second intermediate range value; and add the third multiplication result and the fourth multiplication result to obtain the UV sampling coordinate range corresponding to the first edge model region.
[0100] The aforementioned first generation module is further configured to: determine the fourth difference between the second stretching parameter and the fifth specified value in the stretching parameters; determine the fifth difference between the scaling distance value and the sixth specified value; calculate the ratio of the fourth difference to the fifth difference; limit the ratio to a specified numerical range based on a preset range constraint function to obtain a third intermediate range value; obtain the first coordinate range of the second mapping region in the UV projection map of the proxy model in a specified dimension; determine the sixth difference between the seventh specified value and the first coordinate range; use the third intermediate range value as a weight parameter to interpolate the first coordinate range and the sixth difference to obtain an interpolation result; determine the sign function result of the sum of the first intermediate range value and the second intermediate range value; determine the seventh difference between the eighth specified value and the sign function result; and multiply the interpolation result by the seventh difference to obtain the UV sampling coordinate range corresponding to the intermediate model region.
[0101] The aforementioned first rendering module is further used to merge the UV sampling coordinate range corresponding to the first edge model region, the UV sampling coordinate range corresponding to the second edge model region, and the UV sampling coordinate range corresponding to the middle model region to obtain a merged result; determine the specified coordinate component of the first stretching parameter in the merged result and the stretching parameter as the final UV sampling coordinates; and render the preset decal texture onto the proxy model using the final UV sampling coordinates to obtain the final decal effect.
[0102] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-described decal rendering method. This electronic device can be a server or a terminal device.
[0103] See Figure 6 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-mentioned decal effect rendering method.
[0104] Furthermore, Figure 6 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0105] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0106] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. Processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.
[0107] The processor in the aforementioned electronic device, by executing machine-executable instructions, can implement the following operations in the above-mentioned decal effect rendering method: acquiring a target model and a proxy model, and determining a target surface region from the target model; wherein the target model and the proxy model intersect, the target surface region is located on the surface of the target model, and the target surface region is located inside the proxy model; acquiring a scaling distance value and specified vertex values of the proxy model, and controlling the model vertices on the proxy model to perform vertex offset processing based on the scaling distance value and specified vertex values; wherein, in the specified model region of the proxy model, the specified vertex values of the model vertices gradually change along a specified dimension; the specified model region after vertex offset is scaled; generating stretching parameters based on the model space coordinates of the model vertices in the target surface region in the model space of the proxy model; generating UV sampling coordinates of a preset decal texture based on the stretching parameters; rendering the preset decal texture onto the proxy model after vertex offset based on the UV sampling coordinates to obtain the final decal effect; wherein, relative to the original decal effect of the preset decal texture, the local decal region in the final decal effect is scaled; the final decal effect is displayed on the target surface region of the target model.
[0108] In this method, a proxy model is first created for the virtual model, and a target surface region is defined on the target model. The vertex values of the specified model region of the proxy model vary along a specified dimension. Based on the vertex values and scaling distance values, the model vertices of the proxy model are offset. After offsetting, a portion of the proxy model is scaled. Then, using the model space coordinates of the model vertices in the target surface region, the UV sampling coordinates of the decal texture are calculated. Based on these UV sampling coordinates, the decal texture is rendered onto the proxy model, resulting in the decal effect displayed on the target model. Using this method, there is no need to set a skeleton for the decal. By controlling the offset of model vertices and texture sampling, local stretching of the texture can be achieved, reducing the consumption of computing resources and system performance, and improving the stability of system operation.
[0109] The aforementioned proxy model is divided into a first edge model region, an intermediate model region, and a second edge model region along a specified dimension; the specified model region is the intermediate model region; the specified vertex values of the model vertices in the first edge model region are first specified values; the specified vertex values of the model vertices in the second edge model region are second specified values; the specified vertex values of the model vertices in the intermediate model region are values between the first and second specified values; along the specified dimension, the specified vertex values of the model vertices in the intermediate model region gradually increase or gradually decrease.
[0110] The aforementioned proxy model is divided as follows: The UV map of the proxy model is obtained; the UV map is projected along a specified viewpoint to obtain a UV projection map; wherein the UV projection map includes a specified dimension and a first dimension perpendicular to the specified dimension; the dimension corresponding to the specified viewpoint is perpendicular to the UV projection map; the UV projection map is divided into a first mapping region, an intermediate mapping region, and a second mapping region; wherein the edges of the first mapping region and the intermediate mapping region have first coordinate values in the specified dimension; the edges of the intermediate mapping region and the second mapping region have second coordinate values in the specified dimension; the sum of the first coordinate values and the second coordinate values is the length value of the UV projection map in the specified dimension; the proxy model is divided according to the first mapping region, the intermediate mapping region, and the second mapping region to obtain a first edge model region, an intermediate model region, and a second edge model region.
[0111] The processor in the aforementioned electronic device, by executing machine-executable instructions, can implement the following operations in the above-mentioned decal effect rendering method: storing the first specified value in the model vertices of the first edge model region, and storing the second specified value in the model vertices of the second edge model region; for the model vertices of the intermediate model region, storing values in the model vertices based on the distances of the model vertices to the first edge model region and the second edge model region respectively; wherein, the closer a model vertex is to the first edge model region, the closer the value stored in the model vertex is to the first specified value; the closer a model vertex is to the second edge model region, the closer the value stored in the model vertex is to the second specified value.
[0112] The processor in the aforementioned electronic device can execute machine-executable instructions to achieve the following operations in the above-mentioned decal effect rendering method: based on the regional position of the target surface area, render a preset decal texture in the proxy model to obtain an initial decal effect; wherein, the initial decal effect is displayed in the target surface area.
[0113] The processor in the aforementioned electronic device can execute machine-executable instructions to perform the following operations in the above-mentioned decal effect rendering method: obtain scene depth information corresponding to the target surface area, determine the world space coordinates of the model vertices in the target surface area in world space based on the scene depth information; transform the world space coordinates to the model space of the proxy model through a preset transformation matrix to obtain the model space coordinates of the model vertices in the target surface area; and render a preset decal texture in the proxy model based on the model space coordinates to obtain the initial decal effect.
[0114] The processor in the aforementioned electronic device can execute machine-executable instructions to perform the following operations in the above-mentioned decal effect rendering method: multiply the scaling distance value and the specified vertex value stored on the model vertex of the proxy model to obtain a first multiplication result; add the first multiplication result to the coordinate component of the specified dimension in the model space coordinates of the model vertex to obtain the offset value of the model vertex in the specified dimension; and control the model vertex to offset in the specified dimension based on the offset value.
[0115] The processor in the aforementioned electronic device, by executing machine-executable instructions, can perform the following operations in the above-mentioned decal effect rendering method: obtaining a first coordinate component and a second coordinate component from the above-mentioned model space coordinates; wherein, the first coordinate component is the coordinate component in the specified dimension, and the second coordinate component is the coordinate component in the vertical dimension of the specified dimension; adding a first specified value to the first coordinate component and the second coordinate component respectively to obtain an intermediate result, limiting the intermediate result to a specified value range based on a preset range limiting function to obtain a first stretching parameter; adding the first specified value to the first coordinate component to obtain a second stretching parameter.
[0116] The processor in the aforementioned electronic device, by executing machine-executable instructions, can perform the following operations in the above-mentioned decal effect rendering method: determining a first difference between a second specified value and the second stretching parameter in the stretching parameters; limiting the first difference to a specified numerical range based on a preset range limiting function to obtain a first intermediate range value; determining a second difference between a third specified value and the first intermediate range value; obtaining a first coordinate range in a specified dimension of the second texture region in the UV projection texture of the proxy model; multiplying the second difference by the first coordinate range to obtain a second multiplication result; multiplying the second multiplication result by the sign function result of the first intermediate range value to obtain the UV sampling coordinate range corresponding to the second edge model region.
[0117] The processor in the aforementioned electronic device, by executing machine-executable instructions, can perform the following operations in the above-mentioned decal effect rendering method: determine the third difference between the second stretching parameter and the scaling distance value in the stretching parameters, and limit the third difference to a specified numerical range based on a preset range limiting function to obtain a second intermediate range value; obtain the first coordinate range in a specified dimension of the second texture region in the UV projection texture of the proxy model; multiply the second intermediate range value by the first coordinate range to obtain a third multiplication result; obtain the fourth multiplication result of the sign function result of the fourth specified value, the difference between the first coordinate range and the second intermediate range value; add the third multiplication result and the fourth multiplication result to obtain the UV sampling coordinate range corresponding to the first edge model region.
[0118] The processor in the aforementioned electronic device, by executing machine-executable instructions, can perform the following operations in the above-mentioned decal effect rendering method: determining the fourth difference between the second stretching parameter and the fifth specified value in the stretching parameters; determining the fifth difference between the scaling distance value and the sixth specified value; calculating the ratio of the fourth difference to the fifth difference; limiting the ratio to a specified numerical range based on a preset range constraint function to obtain a third intermediate range value; obtaining the first coordinate range in a specified dimension of the second texture region in the UV projection texture of the proxy model; determining the sixth difference between the seventh specified value and the first coordinate range; using the third intermediate range value as a weight parameter, interpolating the first coordinate range and the sixth difference to obtain an interpolation result; determining the sign function result of the sum of the first intermediate range value and the second intermediate range value; determining the seventh difference between the eighth specified value and the sign function result; multiplying the interpolation result by the seventh difference to obtain the UV sampling coordinate range corresponding to the intermediate model region.
[0119] The processor in the aforementioned electronic device can execute machine-executable instructions to perform the following operations in the above-mentioned decal effect rendering method: merging the UV sampling coordinate ranges corresponding to the first edge model region, the second edge model region, and the middle model region to obtain a merged result; determining the specified coordinate components of the first stretching parameter in the merged result and the stretching parameters as the final UV sampling coordinates; and rendering the preset decal texture onto the proxy model using the final UV sampling coordinates to obtain the final decal effect.
[0120] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the above-mentioned decal effect rendering method.
[0121] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to achieve the following operations in the above-mentioned decal effect rendering method: obtaining the target model and the proxy model, and determining the target surface region from the target model; wherein the target model and the proxy model intersect, the target surface region is located on the surface of the target model, and the target surface region is located inside the proxy model; obtaining the scaling distance value and the specified vertex value of the proxy model, and controlling the model vertices on the proxy model to perform vertex offset processing based on the scaling distance value and the specified vertex value; wherein the specified vertex value of the model vertices in the specified model region of the proxy model gradually changes along the specified dimension; the specified model region after vertex offset is scaled; generating stretching parameters based on the model space coordinates of the model vertices in the target surface region in the model space of the proxy model; generating UV sampling coordinates of the preset decal texture based on the stretching parameters; rendering the preset decal texture onto the proxy model after vertex offset based on the UV sampling coordinates to obtain the final decal effect; wherein, relative to the original decal effect of the preset decal texture, the local decal region in the final decal effect is scaled; the final decal effect is displayed on the target surface region of the target model.
[0122] In this method, a proxy model is first created for the virtual model, and a target surface region is defined on the target model. The vertex values of the specified model region of the proxy model vary along a specified dimension. Based on the vertex values and scaling distance values, the model vertices of the proxy model are offset. After offsetting, a portion of the proxy model is scaled. Then, using the model space coordinates of the model vertices in the target surface region, the UV sampling coordinates of the decal texture are calculated. Based on these UV sampling coordinates, the decal texture is rendered onto the proxy model, resulting in the decal effect displayed on the target model. Using this method, there is no need to set a skeleton for the decal. By controlling the offset of model vertices and texture sampling, local stretching of the texture can be achieved, reducing the consumption of computing resources and system performance, and improving the stability of system operation.
[0123] The aforementioned proxy model is divided into a first edge model region, an intermediate model region, and a second edge model region along a specified dimension; the specified model region is the intermediate model region; the specified vertex values of the model vertices in the first edge model region are first specified values; the specified vertex values of the model vertices in the second edge model region are second specified values; the specified vertex values of the model vertices in the intermediate model region are values between the first and second specified values; along the specified dimension, the specified vertex values of the model vertices in the intermediate model region gradually increase or gradually decrease.
[0124] The aforementioned proxy model is divided as follows: The UV map of the proxy model is obtained; the UV map is projected along a specified viewpoint to obtain a UV projection map; wherein the UV projection map includes a specified dimension and a first dimension perpendicular to the specified dimension; the dimension corresponding to the specified viewpoint is perpendicular to the UV projection map; the UV projection map is divided into a first mapping region, an intermediate mapping region, and a second mapping region; wherein the edges of the first mapping region and the intermediate mapping region have first coordinate values in the specified dimension; the edges of the intermediate mapping region and the second mapping region have second coordinate values in the specified dimension; the sum of the first coordinate values and the second coordinate values is the length value of the UV projection map in the specified dimension; the proxy model is divided according to the first mapping region, the intermediate mapping region, and the second mapping region to obtain a first edge model region, an intermediate model region, and a second edge model region.
[0125] The machine-executable instructions stored in the aforementioned machine-readable storage medium can, by executing the machine-executable instructions, implement the following operations in the above-mentioned decal effect rendering method: storing the first specified value in the model vertices of the first edge model region, and storing the second specified value in the model vertices of the second edge model region; for the model vertices of the intermediate model region, storing values in the model vertices based on the distances of the model vertices from the first edge model region and the second edge model region respectively; wherein, the closer a model vertex is to the first edge model region, the closer the value stored in the model vertex is to the first specified value; the closer a model vertex is to the second edge model region, the closer the value stored in the model vertex is to the second specified value.
[0126] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to achieve the following operations in the above-mentioned decal effect rendering method: based on the regional position of the target surface area, a preset decal texture is rendered in the proxy model to obtain the initial decal effect; wherein, the initial decal effect is displayed in the target surface area.
[0127] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to achieve the following operations in the above-mentioned decal effect rendering method: obtain scene depth information corresponding to the target surface area, determine the world space coordinates of the model vertices in the target surface area in world space based on the scene depth information; transform the world space coordinates to the model space of the proxy model through a preset transformation matrix to obtain the model space coordinates of the model vertices in the target surface area; and render a preset decal texture in the proxy model based on the model space coordinates to obtain the initial decal effect.
[0128] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to achieve the following operations in the above decal effect rendering method: multiply the scaling distance value and the specified vertex value stored on the model vertex of the proxy model to obtain a first multiplication result; add the first multiplication result to the coordinate component of the specified dimension in the model space coordinates of the model vertex to obtain the offset value of the model vertex in the specified dimension; and control the model vertex to offset in the specified dimension based on the offset value.
[0129] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be used to execute the following operations in the above-mentioned decal effect rendering method: obtaining a first coordinate component and a second coordinate component from the aforementioned model space coordinates; wherein the first coordinate component is the coordinate component in the specified dimension, and the second coordinate component is the coordinate component in the vertical dimension of the specified dimension; adding a first specified value to the first coordinate component and the second coordinate component respectively to obtain an intermediate result; limiting the intermediate result to a specified value range based on a preset range limiting function to obtain a first stretching parameter; adding the first specified value to the first coordinate component to obtain a second stretching parameter.
[0130] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to achieve the following operations in the above-mentioned decal effect rendering method: determining a first difference between a second specified value and the second stretching parameter in the stretching parameters; limiting the first difference to a specified value range based on a preset range limiting function to obtain a first intermediate range value; determining a second difference between a third specified value and the first intermediate range value; obtaining a first coordinate range in a specified dimension of the second texture region in the UV projection texture of the proxy model; multiplying the second difference by the first coordinate range to obtain a second multiplication result; multiplying the second multiplication result by the sign function result of the first intermediate range value to obtain the UV sampling coordinate range corresponding to the second edge model region.
[0131] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to achieve the following operations in the above-mentioned decal effect rendering method: determine the third difference between the second stretching parameter and the scaling distance value in the stretching parameters, and limit the third difference to a specified numerical range based on a preset range limiting function to obtain a second intermediate range value; obtain the first coordinate range in a specified dimension of the second texture region in the UV projection texture of the proxy model; multiply the second intermediate range value by the first coordinate range to obtain a third multiplication result; obtain the fourth multiplication result of the sign function result of the fourth specified value, the difference between the first coordinate range and the second intermediate range value; add the third multiplication result and the fourth multiplication result to obtain the UV sampling coordinate range corresponding to the first edge model region.
[0132] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be used to execute the following operations in the above-mentioned decal effect rendering method: determining the fourth difference between the second stretching parameter and the fifth specified value in the stretching parameters; determining the fifth difference between the scaling distance value and the sixth specified value; calculating the ratio of the fourth difference to the fifth difference; limiting the ratio to a specified numerical range based on a preset range constraint function to obtain a third intermediate range value; obtaining the first coordinate range in a specified dimension of the second texture region in the UV projection texture of the proxy model; determining the sixth difference between the seventh specified value and the first coordinate range; using the third intermediate range value as a weight parameter, interpolating the first coordinate range and the sixth difference to obtain an interpolation result; determining the sign function result of the sum of the first intermediate range value and the second intermediate range value; determining the seventh difference between the eighth specified value and the sign function result; multiplying the interpolation result by the seventh difference to obtain the UV sampling coordinate range corresponding to the intermediate model region.
[0133] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to perform the following operations in the above-mentioned decal effect rendering method: merging the UV sampling coordinate ranges corresponding to the first edge model region, the second edge model region, and the middle model region to obtain a merged result; determining the specified coordinate components of the first stretching parameter in the merged result and the stretching parameters as the final UV sampling coordinates; and rendering the preset decal texture onto the proxy model using the final UV sampling coordinates to obtain the final decal effect.
[0134] The computer program products of the decal effect rendering method, apparatus and electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0135] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0136] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0137] If the aforementioned functions are implemented as software functional units 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 this invention, essentially, 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 invention. 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.
[0138] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0139] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention 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 within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these 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 the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for rendering a decal effect, characterized in that, The method includes: Obtain a target model and a proxy model, and determine a target surface region from the target model; wherein the target model and the proxy model intersect, the target surface region is located on the surface of the target model, and the target surface region is located inside the proxy model; Obtain the scaling distance value and the specified vertex value of the proxy model. Based on the scaling distance value and the specified vertex value, control the model vertices on the proxy model to perform vertex offset processing. In a specified model region in the proxy model, the specified vertex value of the model vertex gradually changes along a specified dimension. The specified model region after vertex offset is scaled. Based on the model space coordinates of the model vertices in the target surface region within the model space of the proxy model, stretching parameters are generated; based on the stretching parameters, UV sampling coordinates of a preset decal texture are generated. Based on the UV sampling coordinates, the preset decal texture is rendered onto the proxy model after vertex offset to obtain the final decal effect; wherein, relative to the original decal effect of the preset decal texture, the local decal area in the final decal effect is scaled; the final decal effect is displayed on the target surface area on the target model; The steps of controlling the model vertices on the proxy model to perform vertex offset processing based on the scaling distance value and the specified vertex value include: Multiply the scaling distance value by the specified vertex value stored on the model vertex of the proxy model to obtain the first multiplication result; Add the first multiplication result to the coordinate component of the specified dimension in the model space coordinates of the model vertex to obtain the offset value of the model vertex in the specified dimension; The offset value is used to control the offset of the model vertices in the specified dimension.
2. The method according to claim 1, characterized in that, The proxy model is divided into a first edge model region, an intermediate model region, and a second edge model region along the specified dimension; the specified model region is the intermediate model region. The specified vertex value of the model vertex in the first edge model region is a first specified value; The specified vertex value of the model vertex in the second edge model region is the second specified value; The specified vertex value of the model vertex in the intermediate model region is a value between the first specified value and the second specified value; along the specified dimension, the specified vertex value of the model vertex in the intermediate model region gradually increases or gradually decreases.
3. The method according to claim 2, characterized in that, The proxy model is divided in the following way: Obtain the UV map of the proxy model, and project the UV map along a specified viewpoint to obtain a UV projection map; wherein, the UV projection map includes the specified dimension and a first dimension perpendicular to the specified dimension; the dimension corresponding to the specified viewpoint is perpendicular to the UV projection map; The UV projection map is divided into a first map region, an intermediate map region, and a second map region; wherein the edges of the first map region and the intermediate map region have a first coordinate value in the specified dimension; the edges of the intermediate map region and the second map region have a second coordinate value in the specified dimension; the sum of the first coordinate value and the second coordinate value is the length value of the UV projection map in the specified dimension. The proxy model is divided according to the first texture area, the middle texture area, and the second texture area to obtain the first edge model area, the middle model area, and the second edge model area.
4. The method according to claim 3, characterized in that, After dividing the proxy model according to the first texture region, the intermediate texture region, and the second texture region to obtain the first edge model region, the intermediate model region, and the second edge model region, the method further includes: The first specified value is stored in the model vertices of the first edge model region, and the second specified value is stored in the model vertices of the second edge model region; For the model vertices of the intermediate model region, values are stored in the model vertices based on the distances of the model vertices to the first edge model region and the second edge model region, respectively. Specifically, the closer a model vertex is to the first edge model region, the closer the value stored in that model vertex is to the first specified value; the closer a model vertex is to the second edge model region, the closer the value stored in that model vertex is to the second specified value.
5. The method according to claim 1, characterized in that, Before the step of controlling the model vertices on the proxy model to perform vertex offset processing based on the scaling distance value and the specified vertex value, the method further includes: Based on the location of the target surface area, a preset decal texture is rendered in the proxy model to obtain an initial decal effect; wherein, the initial decal effect is displayed on the target surface area.
6. The method according to claim 5, characterized in that, The steps of rendering a preset decal texture in the proxy model based on the regional location of the target surface area to obtain the initial decal effect include: Obtain scene depth information corresponding to the target surface region, and determine the world space coordinates of the model vertices in the target surface region in world space based on the scene depth information; By using a preset transformation matrix, the world space coordinates are transformed into the model space of the proxy model to obtain the model space coordinates of the model vertices in the target surface region; Based on the model space coordinates, a preset decal texture is rendered in the proxy model to obtain the initial decal effect.
7. The method according to claim 3, characterized in that, The step of generating stretching parameters based on the model space coordinates of the model vertices in the target surface region includes: Obtain a first coordinate component and a second coordinate component from the model space coordinates; wherein the first coordinate component is the coordinate component in the specified dimension, and the second coordinate component is the coordinate component in the vertical dimension of the specified dimension; The first coordinate component and the second coordinate component are respectively added to a first specified value to obtain an intermediate result. The intermediate result is then restricted to a specified value range based on a preset range restriction function to obtain a first stretching parameter. The first specified value is half the length or width of the proxy model. The first coordinate component is added to the first specified value to obtain the second stretching parameter.
8. The method according to claim 7, characterized in that, The step of generating the UV sampling coordinates of the preset decal texture based on the stretching parameters includes: Determine the first difference between the second specified value and the second stretching parameter in the stretching parameters, and limit the first difference to a specified value range based on a preset range limiting function to obtain a first intermediate range value; wherein, the second specified value is 1; Determine a second difference between a third specified value and the first intermediate range value; the third specified value is the same as the second specified value. Obtain the first coordinate range of the second texture region in the specified dimension of the UV projection texture of the proxy model; Multiply the second difference by the first coordinate range to obtain the second multiplication result; multiply the second multiplication result by the sign function result of the first intermediate range value to obtain the UV sampling coordinate range corresponding to the second edge model region.
9. The method according to claim 7, characterized in that, The step of generating the UV sampling coordinates of the preset decal texture based on the stretching parameters includes: Determine the third difference between the second stretching parameter and the scaling distance value in the stretching parameters, and limit the third difference to a specified numerical range based on a preset range limiting function to obtain a second intermediate range value; Obtain the first coordinate range of the second texture region in the specified dimension of the UV projection texture of the proxy model; Multiply the second intermediate range value by the first coordinate range to obtain the third multiplication result; Obtain the fourth multiplication result of the sign function of the difference between the fourth specified value and the first coordinate range and the second intermediate range value; wherein, the fourth specified value is 1; The third multiplication result and the fourth multiplication result are added together to obtain the UV sampling coordinate range corresponding to the first edge model region.
10. The method according to claim 7, characterized in that, The step of generating the UV sampling coordinates of the preset decal texture based on the stretching parameters includes: Determine the fourth difference between the second stretching parameter and the fifth specified value in the stretching parameters, determine the fifth difference between the scaling distance value and the sixth specified value, and calculate the ratio of the fourth difference to the fifth difference; wherein, both the fifth specified value and the sixth specified value are 1; Based on a preset range limiting function, the ratio is limited to a specified numerical range to obtain a third intermediate range value; Obtain the first coordinate range of the second mapping region in the specified dimension of the UV projection map of the proxy model; determine the sixth difference between the seventh specified value and the first coordinate range; wherein the seventh specified value is 1; Using the third intermediate range value as a weight parameter, interpolation is performed on the first coordinate range and the sixth difference to obtain the interpolation result; Determine the sign function result of the sum of the first intermediate range value and the second intermediate range value; determine the seventh difference between the eighth specified value and the sign function result; wherein the eighth specified value is 1; Multiply the interpolation result by the seventh difference to obtain the UV sampling coordinate range corresponding to the intermediate model region.
11. The method according to claim 7, characterized in that, The steps of rendering the preset decal texture onto the proxy model after vertex offset based on the UV sampling coordinates to obtain the final decal effect include: The UV sampling coordinate ranges corresponding to the first edge model region, the second edge model region, and the intermediate model region are merged to obtain a merged result. The merged result and the specified coordinate component of the first stretching parameter in the stretching parameters are determined as the final UV sampling coordinates; The preset decal texture is rendered onto the proxy model using the final UV sampling coordinates to obtain the final decal effect.
12. A rendering device for a decal effect, characterized in that, The device includes: The first determining module is used to acquire a target model and a proxy model, and to determine a target surface region from the target model; wherein the target model and the proxy model intersect, the target surface region is located on the surface of the target model, and the target surface region is located inside the proxy model; The first control module is used to obtain the scaling distance value and the specified vertex value of the proxy model, and control the model vertices on the proxy model to perform vertex offset processing based on the scaling distance value and the specified vertex value; wherein, in a specified model region in the proxy model, the specified vertex value of the model vertex gradually changes along a specified dimension; the specified model region after vertex offset is scaled. The first generation module is used to generate stretching parameters based on the model space coordinates of the model vertices in the target surface region in the model space of the proxy model; and to generate UV sampling coordinates of a preset decal texture based on the stretching parameters. The first rendering module is used to render the preset decal texture to the proxy model after vertex offset based on the UV sampling coordinates to obtain the final decal effect; wherein, relative to the original decal effect of the preset decal texture, the local decal area in the final decal effect is scaled; the final decal effect is displayed on the target surface area on the target model; The first control module is also used to multiply the scaling distance value and the specified vertex value stored on the model vertex of the proxy model to obtain a first multiplication result; Add the first multiplication result to the coordinate component of the specified dimension in the model space coordinates of the model vertex to obtain the offset value of the model vertex in the specified dimension; The offset value is used to control the offset of the model vertices in the specified dimension.
13. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the decal effect rendering method according to any one of claims 1-11.
14. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the decal effect rendering method according to any one of claims 1-11.
Citation Information
Patent Citations
Patch-based surface relaxation
US20190251745A1
Methods and Systems for Determining Decal Projections Intersecting Spacial Units in a Frame of a Game Space
US20220203231A1