Method and device for rendering dynamic effects, electronic device, storage medium
Patent Information
- Application Number
- CN202211648469.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-21
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2042-12-21
AI Technical Summary
[0003]现有技术中,在制作动态效果的模型时,需要为每一种动态效果绘制大量贴图才能实现相应的动态效果,生成效率低,并且每张贴图一般仅可以适用于一种动态效果,贴图的利用率低,存在很大的资源浪费情况
[0017]在本申请实施例中,通过运行应用程序,在终端设备的显示屏上显示图形用户界面,图形用户界面中包括多个不同的渲染选项,实现了将多种渲染方式集成到同一个图形用户界面中,方便用户制作不同动态效果的模型。响应于针对目标渲染选项的启动操作,获取待渲染的目标模型元素贴图,目标渲染选项为多个不同的渲染选项中的任意一个,元素贴图是用于确定目标模型的动态元素;采用目标渲染选项对应的目标渲染算法对元素贴图进行处理,得到对应的动态贴图,动态贴图包含了动态元素位置随时间变化的关系;基于动态贴图对目标模型进行渲染处理,得到目标模型的动态效果;本申请实施例只需要一张元素贴图,通过选择不同的渲染选项来得到多种不同的动态效果,提高了动态效果的生成效率,同时还节省了贴图资源和存储空间。
Smart Images

Figure CN115814415B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer graphics technology, and in particular to methods and apparatuses for rendering models with dynamic effects, electronic devices, and storage media. Background Technology
[0002] In game or animated video scenes, it is often necessary to display models with dynamic effects. Taking racing games as an example, the game can provide players with a variety of virtual vehicles of different series. Virtual vehicles of the same series will also need to display different dynamic effects depending on the player's game level. That is, virtual vehicles of the same series corresponding to different player levels have the same dynamic elements, but the dynamic effects produced by the dynamic elements are different.
[0003] In existing technologies, when creating models with dynamic effects, a large number of textures need to be drawn for each dynamic effect to achieve the corresponding dynamic effect, resulting in low generation efficiency and high latency for each texture. Figure 1 Generally, it can only be applied to one dynamic effect, the utilization rate of textures is low, and there is a great waste of resources.
[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] In view of the above problems, this application is made to provide a model rendering method, apparatus, electronic device, and storage medium for overcoming or at least partially solving the above problems, including:
[0006] A method for rendering a model with dynamic effects involves running an application to display a graphical user interface on a terminal device's screen. The graphical user interface includes multiple different rendering options. The method includes:
[0007] In response to a startup operation for a target rendering option, an element texture map of the target model to be rendered is obtained, wherein the target rendering option is any one of the plurality of different rendering options, and the element texture map is used to determine the dynamic elements of the target model;
[0008] The element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain a corresponding dynamic texture, which contains the relationship between the position of the dynamic element and time.
[0009] The target model is rendered based on the dynamic texture to obtain the dynamic effect of the target model.
[0010] A dynamic model rendering apparatus displays a graphical user interface on a terminal device's screen by running an application. The graphical user interface includes multiple different rendering options. The apparatus comprises:
[0011] The rendering method determination module is used to obtain the element texture of the target model to be rendered in response to the start operation for the target rendering option. The target rendering option is any one of the multiple different rendering options, and the element texture is used to determine the dynamic elements of the target model.
[0012] The dynamic texture generation module is used to process the element texture using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, wherein the dynamic texture contains the relationship between the position of the dynamic element and the change over time.
[0013] The dynamic effect rendering module is used to render the target model based on the dynamic texture to obtain the dynamic effect of the target model.
[0014] An electronic device includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements a model rendering method for the dynamic effects described above.
[0015] A computer-readable storage medium storing a computer program that, when executed by a processor, implements a model rendering method with the dynamic effects described above.
[0016] This application has the following advantages:
[0017] In this embodiment, by running an application, a graphical user interface (GUI) is displayed on the terminal device's screen. The GUI includes multiple rendering options, integrating various rendering methods into a single GUI, facilitating the creation of models with different dynamic effects. In response to a start operation for a target rendering option, a texture map of the target model element to be rendered is obtained. The target rendering option is any one of multiple different rendering options, and the element texture map is used to determine the dynamic elements of the target model. The element texture map is processed using the target rendering algorithm corresponding to the target rendering option to obtain a corresponding dynamic texture map. The dynamic texture map contains the relationship between the position of the dynamic elements and time. Based on the dynamic texture map, the target model is rendered to obtain the dynamic effect of the target model. This embodiment only requires one element texture map, and by selecting different rendering options, multiple different dynamic effects can be obtained, improving the generation efficiency of dynamic effects while saving texture resources and storage space. Attached Figure Description
[0018] To more clearly illustrate the technical solution of this application, the drawings used in the description of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating the steps of a dynamic effect model rendering method according to an embodiment of this application.
[0020] Figure 2 This is a schematic diagram of a graphical user interface as an example of this application;
[0021] Figure 3 This is a schematic diagram of a dynamic masking example of this application;
[0022] Figure 4 This is a schematic diagram of the first channel texture as an example of this application;
[0023] Figure 5 This is a schematic diagram of the second channel texture as an example of this application;
[0024] Figure 6 In one example of this application, when the target rendering option is the first rendering option, for Figure 4 and Figure 5 A schematic diagram of the processed dynamic texture;
[0025] Figure 7 This is a schematic diagram of the first channel texture as an example of this application;
[0026] Figure 8 This is a schematic diagram of the second channel texture as an example of this application;
[0027] Figure 9 In one example of this application, when the target rendering option is the second rendering option, for Figure 7 and Figure 8 A schematic diagram of the processed dynamic texture;
[0028] Figure 10 This is a schematic diagram of the fourth channel texture as an example of this application;
[0029] Figure 11 This is a schematic diagram of a color channel texture as an example of this application;
[0030] Figure 12 In one example of this application, when the target rendering option is the third rendering option, for Figure 10 and Figure 11 A schematic diagram of the processed dynamic texture;
[0031] Figure 13This is a schematic diagram of the dynamic texture obtained when the target rendering option is the fourth rendering option in one example of this application;
[0032] Figure 14 This is a schematic diagram of the difference between adjacent pixels in an embodiment of this application;
[0033] Figure 15 This is a structural block diagram of a dynamic effect model rendering device according to an embodiment of this application. Detailed Implementation
[0034] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0035] In game or animated video scenes, it's often necessary to showcase models with dynamic effects. For example, in some hyper-realistic racing games, rich, cool, and personalized car paint jobs are undoubtedly indispensable features. These are typically conveyed to players through different styling designs, material rendering, and skill effects, indicating the progression of vehicle levels and the differentiation of their status.
[0036] In existing technologies, when creating models with dynamic effects for each shape, a large number of textures need to be drawn for each dynamic effect to achieve the corresponding dynamic effect. This results in low generation efficiency, and each texture... Figure 1 Generally, this approach can only be applied to one type of dynamic effect, resulting in low texture utilization and significant resource waste. A racing game may have nearly a hundred prototype cars, and each car requires two to three different static paint jobs and dynamic effects. Using existing production methods, it is clearly difficult to meet these requirements.
[0037] In view of this, the embodiments of this application provide a method for rendering dynamic effects of a model. The method processes element textures through a rendering algorithm to obtain corresponding dynamic textures, and then renders the target model based on the dynamic textures to obtain the dynamic effects of the target model. This method achieves the goal of generating corresponding dynamic effects with only one element texture, thus improving the generation efficiency of dynamic effects. Furthermore, by integrating multiple rendering methods into the same graphical user interface, models with different dynamic effects can be created with only one element texture, which not only improves the generation efficiency of dynamic effects but also greatly reduces texture resources and storage space.
[0038] The dynamic effect model rendering method provided in this application embodiment can run on a local terminal device or a server. When the dynamic effect model rendering method runs on a server, it can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0039] In an optional implementation, various cloud applications can run under the cloud interaction system. In the cloud application's operating mode, the application's runtime and the screen presentation are separated. The storage and execution of dynamic effect model rendering methods are completed on the cloud gaming server. The client device is used for data reception, transmission, and screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a first terminal device, television, computer, or PDA; however, the dynamic effect model rendering is performed by the cloud server in the cloud. When the cloud application is running, the user operates the client device to send operation commands to the cloud server. The cloud server runs the application according to the operation commands, encodes and compresses the corresponding screen data, returns it to the client device via the network, and finally, the client device decodes and outputs the corresponding screen.
[0040] Reference Figure 1 This document illustrates a flowchart of a dynamic effect model rendering method according to an embodiment of this application. In this embodiment, an application is run to display a graphical user interface (GUI) on a terminal device's screen. The GUI includes multiple different rendering options. It can be understood that the application can run on the terminal device and display the GUI on its screen, or it can run on a server, with the server interacting with the terminal device to display the GUI. Each rendering option corresponds to a set of rendering algorithms, and different rendering options correspond to different rendering algorithms. The method may include the following steps:
[0041] Step 101: In response to the start operation for the target rendering option, obtain the element texture of the target model to be rendered, wherein the target rendering option is any one of the plurality of different rendering options, and the element texture is used to determine the dynamic elements of the target model.
[0042] like Figure 2 The diagram shown is a schematic of a graphical user interface (GUI) in an example of this application. The GUI includes a menu bar, a view area, and a parameter control area. The menu bar displays access to most functions, the view area displays the target model to be rendered and the rendered result, and the parameter control area displays parameters for user selection or modification, such as... Figure 2As shown, the parameter control area can display multiple rendering options, such as the first rendering option, the second rendering option, the third rendering option, and the fourth rendering option.
[0043] Users can choose any rendering option to use the corresponding rendering algorithm to process element textures, render the target model, and obtain the corresponding dynamic effects.
[0044] Upon detecting a launch operation for a target rendering option, the element textures of the target model to be rendered can be obtained. The launch operation can include the user activating the function of the corresponding control by pressing one or more preset physical buttons. For example, when the pointer is pointing to the target rendering option, pressing one or more preset physical buttons activates the function of that target rendering option. When the terminal device's display is a touchscreen, the user can also trigger the function by clicking or long-pressing the location of the corresponding control. For example, clicking the target rendering option activates the function of that target rendering option.
[0045] Optionally, the target rendering option corresponding to the startup operation can be displayed differently from other rendering options in the graphical user interface, or a corresponding startup identifier can be added. For example... Figure 2 As shown, the selection box corresponding to the first rendering option displays differently from the selection boxes corresponding to other rendering options, indicating that the currently selected target option is the first rendering option.
[0046] The target model can be imported by the user or read sequentially from the model library by the application in a preset order. For example, the model library may include multiple models to be rendered. These models can be sorted by generation time or by model name to obtain a preset order. The application then reads the model to be processed from the model library in the preset order as the target model.
[0047] Element mapping is used to determine the dynamic elements of the target model. Dynamic elements refer to the original information of each pixel used to generate the dynamic map. It can be understood that by processing the dynamic elements in the element map, the position and pixel values of these dynamic elements change over time. Preferably, the element map is a continuous four-sided map to avoid obvious pixel-cutting boundaries. Element maps can be imported into the application by the user or selected from an element map library associated with the application. In an optional embodiment, the graphical user interface may further include an element map option associated with the element map library. The user can open the element map library through the element map option and then select the element map of the target model from the library. That is, the above method may further include:
[0048] In response to a trigger operation for the element texture option, an element texture library interface is displayed in the graphical user interface, the element texture library interface including a variety of candidate element textures to choose from;
[0049] In response to a selection operation for any of the candidate element maps, the candidate element map corresponding to the selection operation is determined as the element map of the target model.
[0050] The candidate element textures in the element texture library can also be updated based on element textures imported by the user.
[0051] It should be noted that during the rendering of the target model, the order in which the user performs the operation of starting the target rendering option and selects or imports the element textures of the target model is not important.
[0052] Step 102: Process the element texture using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, which contains the relationship between the position of the dynamic element and time.
[0053] Different rendering options correspond to different rendering algorithms, meaning that different rendering algorithms process element textures differently. In response to the activation operation for a target rendering option, the corresponding rendering algorithm can be determined, and then used to process the element textures to obtain the appropriate dynamic textures.
[0054] In some optional embodiments of this application, the element texture includes multiple channel textures. During the processing of the element texture using the target rendering algorithm, at least two channel textures in the element texture can be processed. One channel texture is used to store dynamic elements, and the other channel textures are used to affect the display effect of dynamic elements, including affecting the display brightness, movement speed, movement direction, scaling direction, etc. of dynamic elements. By scaling, offsetting, and other transformation processing of the channel texture storing dynamic elements, and scaling, offsetting, and other transformation processing of other channel textures, it is possible to generate diverse dynamic effects using the same target rendering algorithm and the same element texture.
[0055] Dynamic textures contain the relationship between the position of dynamic elements and time. When the target model is rendered using dynamic textures, the target model can present corresponding dynamic effects.
[0056] Step 103: Render the target model based on the dynamic texture to obtain the dynamic effect of the target model.
[0057] After obtaining the dynamic texture of the target model, the target model is rendered based on the dynamic texture, so that the surface of the rendered target model can present the effect of dynamic elements changing dynamically.
[0058] In this embodiment, the user can select any rendering option to use the corresponding rendering algorithm to process the element texture and render the target model to obtain the corresponding dynamic effect. This achieves the goal of obtaining the corresponding dynamic effect with only one element texture, reducing the cost of texture production and improving the rendering efficiency of dynamic effects. Furthermore, by integrating multiple rendering methods into the same graphical user interface, models with different dynamic effects can be created with only one element texture, which not only improves the generation efficiency of dynamic effects but also greatly reduces texture resources and storage space.
[0059] Furthermore, considering that in some scenarios the target model has a corresponding original texture map, this original texture map can be understood as the original surface texture when the target model does not need to present dynamic effects. In some optional embodiments of this application, the above-mentioned rendering processing of the target model based on the dynamic texture map to obtain the dynamic effect of the target model may further include:
[0060] Obtain the original texture map and dynamic mask of the target model; each pixel in the dynamic mask is used to determine the fusion weight between each pixel of the original texture map and the corresponding pixel of the dynamic map;
[0061] The original texture map and the dynamic texture map are fused according to the dynamic mask to obtain a fused texture map;
[0062] The dynamic region is rendered based on the fused texture to obtain the dynamic effect of the target model.
[0063] This embodiment uses dynamic masking to determine the fusion weight of the original texture map and the dynamic map, which can realize the rendering of dynamic effects in part of the target model, and can control the weight of the dynamic effects to meet the rendering requirements of different scenes.
[0064] For example, the graphical user interface may also include a dynamic mask editing entry, which allows users to open the dynamic mask editing interface to create or modify dynamic masks.
[0065] like Figure 3The diagram illustrates a dynamic masking method in one example of this application. The pixel values of each pixel in the dynamic mask range from 0 to 1. In the target model, the first model region corresponding to the area with a pixel value of 0 in the dynamic mask (i.e., the black area in the dynamic mask) is affected by the dynamic texture with a value of 0. This means the dynamic texture has a fusion weight of 0 in the first model region, while the original texture has a fusion weight of 1 in the first model region. In other words, the original texture is displayed in the first model region. Similarly, in the target model, the second model region corresponding to the area with a pixel value of 1 in the dynamic mask (i.e., the white area in the dynamic mask) is affected by the dynamic texture with a value of 1. The original texture has a fusion weight of 0 in the second model region, meaning the dynamic texture is displayed in the second model region. The third model region corresponding to the area in the target model where the pixel value of the dynamic mask is greater than 0 and less than 1 (i.e., the gray area in the dynamic mask) is affected by the dynamic texture to the same extent as the pixel value. That is, when the pixel value is 0.5, the fusion weight of the dynamic texture in the third model region is 50%, while the fusion weight of the original texture in the third model region is 50%. In other words, the third model region is affected by both the original texture and the dynamic texture.
[0066] Furthermore, to facilitate greater diversity in the colors of dynamic elements, in some optional embodiments of this application, the graphical user interface may further include element color options for users to adjust the colors of dynamic elements, and the above method may further include:
[0067] Obtain the element colors of the target model; the element colors are used to adjust the colors of the dynamic elements;
[0068] The dynamic texture is processed according to the element color to update the dynamic texture.
[0069] In this embodiment, the user can adjust the element color through the element color options provided by the graphical user interface. For example, when the user triggers the element color option, a color panel can be displayed in the graphical user interface. The color panel includes a variety of colors, and the user can select any one of them as the element color. After generating the dynamic texture, the dynamic texture can be updated by obtaining the element color of the target model and processing it according to the element color. The updated dynamic texture is affected by the element color.
[0070] One method for processing dynamic textures based on element colors is to determine the weight of the dynamic texture based on the pixel values of each pixel in the dynamic texture, and then fuse the element colors and the dynamic texture according to the weights to update the dynamic texture and obtain the updated dynamic texture.
[0071] Taking a black and white dynamic texture as an example, for areas with a pixel value of 0 in the dynamic texture (i.e., black areas), the weight of the dynamic texture is 0. This means that this area is affected by the element's color; for example, if the element's color is red, then this area will appear red. For areas with a pixel value of 1 in the dynamic texture (i.e., white areas), the weight of the dynamic texture is 1. This means that this area is not affected by the element's color; regardless of the element's color, this area will always appear white.
[0072] In this embodiment, users can select element colors through the element color option, and achieve dynamic effects of different colored dynamic elements by selecting different element colors.
[0073] It should be noted that, in some optional embodiments of this application, during the processing of dynamic textures based on element colors, corresponding color blending algorithms can be configured according to different target rendering algorithms, and adjustable parameters such as brightness and blending weights can be developed to influence the color blending results. For example, the interpolation function lerp() can be used to implement color blending.
[0074] The following will further explain the process of processing element textures using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic textures in this exemplary embodiment.
[0075] An element texture consists of a first-channel texture, a second-channel texture, a third-channel texture, and a fourth-channel texture. The first, second, and third channel textures represent the three color channels of the element texture. For example, the first channel texture can refer to the red channel (R channel), the second channel texture to the green channel (G channel), the third channel texture to the blue channel (B channel), and the fourth channel texture to the opacity channel (A channel). Furthermore, the first, second, and third channel textures together constitute the element texture's color channel texture.
[0076] It is understandable that the first, second, third, and fourth channel textures are used to store black and white information, i.e., grayscale information, while the color channel textures are used to store color information.
[0077] In an optional embodiment of this application, when the target rendering option is the first rendering option, the target rendering algorithm corresponding to the first rendering option can be a rendering algorithm for achieving highly controllable random texture changes.
[0078] In this embodiment, the rendering algorithm corresponding to the first rendering option can use only the first and second channel textures of the element texture. The process of processing the element texture using the rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture may include:
[0079] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0080] The first channel texture is sampled based on the first texture coordinate information to obtain the first sampling result;
[0081] The texture coordinate information is scaled according to the second scaling parameter and the first sampling result, and offset according to the second offset to obtain the second texture coordinate information; the second offset is obtained according to the second offset parameter and time information.
[0082] The second channel texture is sampled based on the third texture coordinate information to obtain the dynamic texture corresponding to the first rendering option.
[0083] The target model possesses texture coordinate information, also known as UV information. This information serves as an index connecting the texture map and the 3D model, indicating the correspondence between a portion of the texture map and a face of the 3D model. The texture coordinate information of the target model can be represented as IN.TexCoord.xy. The first scaling parameter is a two-dimensional parameter, represented by DetailUV.xy. Scaling the texture coordinate information according to the first scaling parameter can be expressed as IN.TexCoord.xy * DetailUV.xy, meaning the scaling operation related to the first scaling parameter is multiplied by the first scaling parameter. The first offset parameter is a two-dimensional parameter, represented by DetailUV.zw. The first offset is obtained based on the first offset parameter and time information, and can be represented as DetailUV.zw * TIME, where TIME represents time information. Offsetting the texture coordinate information according to the first offset parameter can be expressed as IN.TexCoord.xy + DetailUV.zw * TIME, meaning the offset operation related to the first offset is added to the first offset parameter.
[0084] In one example, the texture coordinate information of the target model is scaled according to the first scaling parameter and offset according to the first offset to obtain the first texture coordinate information, which can be expressed as: flowTC1 = IN.TexCoord.xy * DetailUV.xy + DetailUV.zw * TIME, where flowTC1 is the first texture coordinate information, that is, the first texture coordinate information is equal to the texture coordinate information multiplied by the first scaling parameter and then added to the first offset, so that the first texture coordinate information can change with time; correspondingly, the first sampling result obtained by sampling the first channel texture according to the first texture coordinate information will also change with time.
[0085] Taking the R-channel texture as an example, the first channel texture is sampled based on the first texture coordinate information to obtain the first sampling result, which can be expressed as: detailMask = tCarDetailMap.SampleBias(sCarDetailMapSampler,flowTC,SampleMipBias).r, where detailMask represents the first sampling result, CarDetailMap represents the element texture, SampleBias() represents the sampling function, r represents the R channel, and tCarDetailMap.SampleBias(sCarDetailMapSampler,flowTC,SampleMipBias).r represents sampling the first channel texture of the element texture based on the first texture coordinate information. The first sampling result is two-dimensional information, that is, the first sampling result can be considered as the result of the first channel texture being scaled and moved over time, and the scaling degree is determined by the first scaling parameter, while the moving speed and direction are determined by the first offset parameter.
[0086] Since the first channel texture is used to store black and white information, the first sampling result obtained by sampling the first channel texture can be represented as the first black and white texture.
[0087] In other examples, the above-described scaling of the texture coordinate information of the target model according to the first scaling parameter and offsetting of the texture coordinate information according to the first offset to obtain the first texture coordinate information can also be expressed as flowTC1 = (IN.TexCoord.xy + DetailUV.zw * TIME) * DetailUV.xy, that is, the first texture coordinate information is equal to the texture coordinate information plus the first offset, and then multiplied by the first scaling parameter; the obtained first texture coordinate information can also change with time, and thus the first sampling result obtained by sampling the first channel texture according to the first texture coordinate information will also change with time. The first sampling result is also two-dimensional information and can be represented by a corresponding two-dimensional image.
[0088] The second scaling parameter is a two-dimensional parameter, represented by `Disturb.xy`. Scaling the texture coordinate information according to this parameter is expressed as `IN.TexCoord.xy*Disturb.xy`, meaning the scaling operation related to the second scaling parameter is multiplied by it. The second offset parameter is also a two-dimensional parameter, represented by `Disturb.zw`. The second offset is obtained based on the second offset parameter and time information, and can be represented as `Disturb.zw*TIME`, where `TIME` represents the time information. Offsetting the texture coordinate information according to the second offset parameter is expressed as `IN.TexCoord.xy+Disturb.zw*TIME`, meaning the offset operation related to the second offset parameter is added to it.
[0089] In one example, the texture coordinate information is scaled according to the second scaling parameter and the first sampling result, and offset according to the second offset to obtain the second texture coordinate information, which can be expressed as: flowTC2 = IN.TexCoord.xy * Disturb.xy * detailMask + Disturb.zw * TIME, where flowTC2 represents the second texture coordinate information, that is, the second texture coordinate information is equal to the texture coordinate information multiplied by the second scaling parameter and the first sampling result, and then added to the second offset, so that the second texture coordinate information can change with time; correspondingly, the sampling result obtained by sampling the second channel map according to the second texture coordinate information will also change with time. It can be understood that the first sampling result obtained by sampling the first channel map will affect the rendering effect of the pixels of the second channel map, that is, the information stored in the first channel map can affect the rendering effect of the dynamic elements stored in the second channel map, for example, causing the dynamic elements stored in the second channel map to have changes in brightness, etc. The sampling result at this time is two-dimensional information, which can be represented by a corresponding two-dimensional image, which is the dynamic texture corresponding to the first rendering option.
[0090] Taking the second channel texture as an example, the second channel texture is sampled based on the second texture coordinate information to obtain a dynamic texture, which can be represented as: detailMask2 = tCarDetailMap.SampleBias(sCarDetailMapSampler, flowTC2, SampleMipBias).g. Here, detailMask2 represents the result of the target rendering algorithm corresponding to the first target option sampling the second channel texture, i.e., the dynamic texture, which is also a two-dimensional black and white image.
[0091] like Figure 4 The image shown is a schematic diagram of the first channel texture in an example of this application. Figure 5 This is a schematic diagram of the second channel texture as an example of this application. Figure 6 In one example of this application, the rendering algorithm corresponding to the first rendering option is based on Figure 4 The first channel texture shown and Figure 5The diagram illustrates how the dynamic texture obtained from the second channel texture processing changes over time. It can be understood that the rendering algorithm corresponding to the first rendering option performs two sampling processes on the element texture. The first sampling process is applied to the first channel texture of the element texture, and the second sampling process is applied to the second channel texture of the element texture. The results of these two sampling processes change in real time during overlap and collision in each frame, resulting in different texture states. In other words, the dynamic texture changes its texture state in real time, achieving a dynamic effect. This dynamic effect is particularly suitable for abstract patterns and texture elements, such as technological elements, churning clouds, and mosaic changes.
[0092] In this embodiment, the first scaling parameter and the first offset parameter are used to control the sampling result of the first channel texture, i.e., the first sampling result. The first sampling result, the second scaling parameter, and the second offset parameter are used to control the sampling result of the second channel texture to obtain the corresponding dynamic texture.
[0093] The first scaling parameter, first offset parameter, second scaling parameter, and second offset parameter can be set by system defaults or by user-defined settings. User-defined settings include modifying the system default parameters. For example, the graphical user interface includes multiple parameter options, which may include at least the first scaling parameter option, the first offset parameter option, the second scaling parameter option, and the second offset parameter option. Each parameter option has a corresponding parameter input box. When the dynamic effect produced by the system default parameters does not meet the user's needs, the user can adjust the corresponding parameters through the parameter input boxes, allowing the application to process the element texture based on the user-adjusted parameters.
[0094] It is understandable that the above methods may also include:
[0095] In response to an adjustment operation on a parameter in at least one parameter input box, determine the new parameter corresponding to the adjustment operation;
[0096] Based on the new parameters, the element textures are processed using the rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic textures.
[0097] Since the first scaling parameter, first offset parameter, second scaling parameter, and second offset parameter are all two-dimensional parameters, and the first scaling parameter is represented as DetailUV.xy, it can be understood that the first scaling parameter is jointly determined by the two parameters DetailUV.x and DetailUV.y. Therefore, when setting or adjusting the first scaling parameter, both DetailUV.x and / or DetailUV.y can be set or adjusted. Similarly, setting or adjusting the first offset parameter, second scaling parameter, and second offset parameter includes setting or adjusting at least one of the one-dimensional parameters.
[0098] In another optional embodiment of this application, when the target rendering option is the second rendering option, the target rendering algorithm corresponding to the second rendering option can be a rendering algorithm used to implement texture perturbation.
[0099] In this embodiment, the rendering algorithm corresponding to the second rendering option can use only the first and second channel textures of the element texture. The process of processing the element texture using the rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture may include:
[0100] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinates are offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0101] The first channel texture is sampled based on the first texture coordinate information to obtain the first sampling result;
[0102] The texture coordinate information is scaled according to the second scaling parameter, and offset according to the second offset and perturbation information to obtain the third texture coordinate information; the second offset is obtained according to the second offset parameter and time information; the perturbation information is obtained according to the perturbation intensity control parameter and the first sampling result.
[0103] The second channel texture is sampled based on the third texture coordinate information to obtain the dynamic texture corresponding to the second rendering option.
[0104] The process of obtaining the first sampling result in this embodiment is similar to the process of obtaining the first sampling result by the rendering algorithm corresponding to the first rendering option. For details, please refer to the description of the previous embodiment, which will not be repeated here.
[0105] The second scaling parameter is a two-dimensional parameter, represented by `Disturb.xy`. Scaling the texture coordinate information according to this parameter is expressed as `IN.TexCoord.xy*Disturb.xy`, meaning the scaling operation related to the second scaling parameter is multiplied by it. The second offset parameter is also a two-dimensional parameter, represented by `Disturb.zw`. The second offset consists of the second offset parameter and time information, and can be represented as `Disturb.zw*TIME`, where `TIME` represents the time information. Offsetting the texture coordinate information according to this parameter is expressed as `IN.TexCoord.xy+Disturb.zw*TIME`, meaning the offset operation related to the second offset parameter is added to it.
[0106] The disturbance information is obtained based on the disturbance intensity control parameter and the first sampling result. In other words, the disturbance information is determined by the first sampling result and the disturbance intensity control parameter. For example, the disturbance information can be expressed as the product of the disturbance intensity parameter and the first sampling result, i.e., cDarkDgree*detailMask, where cDarkDgree represents the disturbance intensity control parameter, which is used to adjust the brightness of the first sampling result.
[0107] In one example, the texture coordinate information is scaled according to the second scaling parameter and offset according to the second offset and perturbation information to obtain the third texture coordinate information, which can be expressed as: flowTC3 = IN.TexCoord.xy * Disturb.xy + Disturb.zw * TIME + cDarkDgree * detailMask, where flowTC3 is the third texture coordinate information, that is, the third texture coordinate information is equal to the texture coordinate information multiplied by the second scaling parameter, then added to the second offset, and then added to the product of the perturbation intensity control parameter and the first sampling result, so that the third texture coordinate information can change with time; correspondingly, the sampling result obtained by sampling the second channel map according to the third texture coordinate information will also change with time. It can be understood that the first sampling result obtained by sampling the first channel map will affect the rendering effect of the pixels of the second channel map, that is, the information stored in the first channel map can affect the rendering effect of the dynamic elements stored in the second channel map, for example, causing the dynamic elements stored in the second channel map to have distortion or perturbation effects. The sampling result at this time is two-dimensional information, which can be represented by a corresponding two-dimensional image, which is the dynamic texture corresponding to the second rendering option.
[0108] Taking the second channel texture as an example, the second channel texture is sampled based on the third texture coordinate information to obtain a dynamic texture, which can be represented as: detailMask3 = tCarDetailMap.SampleBias(sCarDetailMapSampler, flowTC3, SampleMipBias).g. Here, detailMask3 represents the result of the target rendering algorithm corresponding to the second target option sampling the second channel texture, i.e., the dynamic texture, which is also a two-dimensional black and white image, and g represents the G channel texture.
[0109] like Figure 7 The image shown is a schematic diagram of the first channel texture in an example of this application. Figure 8 This is a schematic diagram of the second channel texture as an example of this application. Figure 9 In one example of this application, the target rendering algorithm corresponding to the second rendering option is based on Figure 7 The first channel texture shown and Figure 8 The diagram illustrates how the dynamic texture obtained from the second channel texture processing changes over time. It can be understood that the rendering algorithm corresponding to the second rendering option performs two sampling processes on the element texture. The first sampling is of the first channel texture of the element texture, and the second sampling is of the second channel texture. When the two sampling results overlap or collide in each frame, they will produce a distorted and disturbed artistic effect. This effect is particularly suitable for textures with figurative patterns, such as distorted lines, water ripples, and schools of fish swimming.
[0110] In this embodiment, the first scaling parameter and the first offset parameter are used to control the sampling result of the first channel texture, i.e., the first sampling result. The first sampling result, the perturbation intensity control parameter, the second scaling parameter, and the second offset parameter are used to control the sampling result of the second channel texture to obtain the corresponding dynamic texture. The perturbation intensity control parameter controls the brightness of the image corresponding to the first sampling result. When the perturbation intensity control parameter increases, the brightness of the image corresponding to the first sampling result increases, which can increase the degree of distortion and perturbation when the two sampling results overlap or collide in each frame. Users can control the dynamic effects of the dynamic elements of the dynamic texture by modifying the perturbation intensity control parameter.
[0111] The first scaling parameter, the first offset parameter, the second scaling parameter, the second offset parameter, and the disturbance intensity parameter can be set by the system default or by the user. The user-defined settings include modifying the system default parameters, which can be found in the previous description and will not be repeated here.
[0112] In another optional embodiment of this application, when the target rendering option is the third rendering option, the rendering algorithm corresponding to the third rendering option can be a rendering algorithm used to implement random texture changes and texture perturbations on the color image.
[0113] In this embodiment, the rendering algorithm corresponding to the third rendering option requires the use of the fourth channel texture and color channel texture of the element texture. The process of processing the element texture using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture may include:
[0114] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0115] The fourth channel texture is sampled based on the first texture coordinate information to obtain a second sampling result;
[0116] The texture coordinate information is scaled according to the scrolling information and the second scaling parameter, and offset according to the second offset and the distortion information to obtain the fourth texture coordinate information; the scrolling information is obtained according to the second sampling result and the scrolling intensity control parameter, the second offset is obtained according to the second offset parameter and the time information, and the distortion information is obtained according to the second sampling result and the distortion intensity control parameter.
[0117] The color channel texture is sampled based on the fourth texture coordinate information to obtain the dynamic texture corresponding to the third rendering option.
[0118] The process of obtaining the first texture coordinate information in this embodiment is similar to the process of obtaining the first texture coordinate information by the rendering algorithm corresponding to the first rendering option. For details, please refer to the description of the previous embodiment, which will not be repeated here.
[0119] Unlike the first rendering option, the rendering algorithm corresponding to the third rendering option, after obtaining the first texture coordinate information, samples the fourth channel texture of the element texture based on the first texture coordinate information. It can be understood that, in this embodiment, the influence channel texture is used to store dynamic elements, and the information stored in the fourth channel texture is used to influence the rendering method of the dynamic elements stored in the color channel texture.
[0120] The above-described sampling process of the fourth channel texture based on the first texture coordinate information to obtain the second sampling result can be expressed as: detailMask4 = tCarDetailMap.SampleBias(sCarDetailMapSampler, flowTC, SampleMipBias).a, where detailMask4 represents the second sampling result. In other words, the second sampling result can be considered as the result of scaling the fourth channel texture over time, with the scaling degree determined by the first scaling parameter, and the movement speed and direction determined by the first offset parameter.
[0121] Since the fourth channel texture is used to store black and white information, the second sampling result obtained by sampling the fourth channel texture can be represented as the second black and white texture.
[0122] The scrolling information is obtained based on the second sampling result and the scrolling intensity control parameter. In other words, the scrolling information is determined by the second sampling result and the scrolling intensity control parameter. For example, the scrolling information can be expressed as: flow = detailMask4 * flowStrength + (1 - flowStrength), where flow represents the scrolling information and flowStrength represents the scrolling intensity control parameter. This scrolling intensity control information is used to adjust the brightness of the second black-and-white texture corresponding to the second sampling result. During the processing of the color channel texture, the scrolling information is used to scale the texture coordinate information, which is represented by multiplying with the scrolling information. It can be considered that the scrolling information affects the brightness of dynamic elements in the color channel texture, thereby affecting the dynamic effect of the dynamic texture.
[0123] The distortion information is obtained based on the second sampling result and the distortion intensity control parameter. In other words, the distortion information is determined by the second sampling result and the distortion intensity control parameter. For example, the distortion information can be represented as the product of the distortion intensity parameter and the second sampling result, i.e., TwistStrength * detailMask4, where TwistStrength represents the distortion intensity parameter. This distortion intensity control parameter can be understood as adjusting the brightness of the second black-and-white texture corresponding to the second sampling result. During the sampling process of the color channel texture, the distortion information is used to offset the texture coordinate information. The addition of the distortion information to the value represents the distortion effect. It can be considered that the distortion information affects the position of dynamic elements in the color channel texture to present a distorted, perturbed dynamic effect. The distortion intensity control parameter is used to control the intensity of the distortion and perturbed effect.
[0124] The second scaling parameter is a two-dimensional parameter, represented by `Disturb.xy`. Scaling the texture coordinate information according to this parameter is expressed as `IN.TexCoord.xy*Disturb.xy`, meaning the scaling operation related to the second scaling parameter is multiplied by it. The second offset parameter is also a two-dimensional parameter, represented by `Disturb.zw`. The second offset consists of the second offset parameter and time information, and can be represented as `Disturb.zw*TIME`, where `TIME` represents the time information. Offsetting the texture coordinate information according to this parameter is expressed as `IN.TexCoord.xy+Disturb.zw*TIME`, meaning the offset operation related to the second offset parameter is added to it.
[0125] In one example, the texture coordinate information is scaled according to the scrolling information and the second scaling parameter, and offset according to the second offset and twist information to obtain the fourth texture coordinate information, which can be expressed as: flowTC4 = IN.TexCoord.xy * flow * Disturb.xy + Disturb.zw * TIME + TwistStrength * detailMask4, where flowTC4 is the fourth texture coordinate information. That is, the fourth texture coordinate information is equal to the texture coordinate information multiplied by the scrolling information and the second scaling parameter, then added to the second offset, and finally added to the product of the twist strength control parameter and the second sampling result. This allows the fourth texture coordinate information to change over time. Correspondingly, the sampling result obtained by sampling the color channel map based on the fourth texture coordinate information will also change over time. It can be understood that the information stored in the fourth channel map can affect the presentation of the color channel map. The sampling result at this time is two-dimensional information, which can be represented by a corresponding two-dimensional image. Since the color channel map is used to store color information, the image obtained by sampling the color channel map at this time is also in color, that is, the dynamic map corresponding to the third rendering option is in color.
[0126] The process involves sampling the color channel texture based on the fourth texture coordinate information to obtain a dynamic texture, which can be represented as: colorMap = tCarDetailMap.SampleBias(sCarDetailMapSampler, flowTC4, SampleMipBias).rgba. Here, colorMap represents the result of sampling the color channel texture; that is, the dynamic texture is a color image.
[0127] like Figure 10 The image shown is a schematic diagram of the fourth channel texture in an example of this application. Figure 11 This is a schematic diagram of a color channel texture as an example of this application. Figure 12 In one example of this application, the rendering algorithm corresponding to the third rendering option is based on Figure 10 The fourth channel texture shown and Figure 11The diagram illustrates the change of the dynamic texture obtained from color channel mapping over time. It can be understood that the rendering algorithm corresponding to the third rendering option performs two sampling processes on the element texture. The first sampling is of the fourth channel texture of the element texture, and the second sampling is of the color channel texture of the element texture. Furthermore, during the sampling of the color channel texture, the results are multiplied and added to the second sampling result. Therefore, the rendering algorithm corresponding to the third rendering option in this embodiment can be considered to combine the effects of the rendering algorithms corresponding to the first and second rendering options, resulting in a dynamic effect that includes both real-time texture changes and distortion / disturbance effects, making it suitable for advanced painting, general painting, and colored flowing light scenarios.
[0128] In this embodiment, the first scaling parameter and the first offset parameter are used to control the sampling result of the fourth channel texture, i.e., the second sampling result. The second sampling result, the scroll intensity control parameter, the twist intensity control parameter, the second scaling parameter, and the second offset parameter are used to control the sampling result of the color channel texture to obtain the corresponding dynamic texture. Users can control the dynamic effects of the dynamic elements of the dynamic texture by modifying the scroll intensity control parameter and the twist intensity control parameter.
[0129] The first scaling parameter, the first offset parameter, the second scaling parameter, the second offset parameter, the rolling intensity control parameter, and the twisting intensity control parameter can be set by the system default or by the user. The user-defined settings include modifying the system default parameters, which can be found in the previous description and will not be repeated here.
[0130] Because the rendering algorithm corresponding to the third rendering option involves multiplying with scrolling information and adding with distortion information during the processing of element textures to obtain dynamic textures, it requires more parameters compared to the rendering algorithms corresponding to the first and second rendering options. In a graphical user interface, increasing parameters means increased memory bandwidth and GPU (Graphics Processing Unit) computational load. To solve this problem, the inventors conceived of a method to reasonably compress the parameters, using the fewest possible panel parameters to cover the actual required parameters, thus achieving performance optimization. Considering that the dynamic texture obtained by the third rendering option is a color texture, the rendering algorithm corresponding to the third rendering option can be divided into two stages: a sampling stage and a color blending stage.
[0131] During the sampling phase, the scrolling intensity control parameter and the twisting intensity control parameter have a significant effect even with a deviation of 0.01, making them unsuitable for compression and merging. In the color mixing phase, parameters required include the overall paint color overlay parameter BaseColor, the static paint color brightness parameter ColorInstensity, the fourth channel texture color parameter CarDetailColor, and the fourth channel texture brightness parameter CarDetailInstensity. The inventors found that the static paint color brightness parameter does not change significantly when the deviation is less than 0. Therefore, in some optional embodiments of this application, the static paint color brightness parameter ColorInstensity is combined with the scrolling intensity control parameter FlowStrength, i.e., a parameter input box is used to represent these two parameters. Specifically, the real number part of the parameter input box can be used as the static paint color brightness parameter, and the decimal part as the scrolling intensity control parameter; or, the value in the parameter input box can be used as the static paint color brightness parameter, and the decimal part as the scrolling intensity control parameter. The static paint color brightness parameter controls the static paint color brightness, which can be understood as the brightness of the color channel texture. By controlling the brightness of the color channel texture, the effect of the generated dynamic texture can also be changed.
[0132] Among them, the rolling strength control parameter can be expressed as:
[0133] #define flowStrength(frac(cDiffColRange));
[0134] Here, cDiffColRange refers to the color range parameter, which can be obtained through the corresponding parameter input box in the graphical user interface. In this example, when cDiffColRange is obtained, its decimal part can be further extracted as a scroll intensity control parameter.
[0135] In another optional embodiment of this application, when the target rendering option is the fourth rendering option, the target rendering algorithm corresponding to the fourth rendering option can be a rendering algorithm for implementing a two-layer flow effect.
[0136] In this embodiment, the rendering algorithm corresponding to the fourth rendering option requires the use of the fourth channel texture and color channel texture of the element texture. The process of processing the element texture using the rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture may include:
[0137] The texture coordinate information of the target model is scaled according to the second scaling parameter, and the texture coordinate information is offset according to the second offset to obtain the fifth texture coordinate information; the second offset is obtained according to the second offset parameter and time information.
[0138] The fourth channel texture is sampled based on the fifth texture coordinate information to obtain the third sampling result;
[0139] The sixth texture coordinate information is determined based on the third sampling result and the disparity offset texture coordinate information, wherein the disparity offset texture coordinate information is obtained by disparity offsetting the texture coordinate information;
[0140] The color channel texture is sampled based on the sixth texture coordinate information to obtain the dynamic texture corresponding to the fourth rendering option.
[0141] The target model has texture coordinate information, also known as UV information. This information is used to connect textures to the 3D model, indicating the correspondence between a portion of the texture and a face of the 3D model. The texture coordinate information of the target model can be represented as IN.TexCoord.xy.
[0142] The second scaling parameter is a two-dimensional parameter, represented by `Disturb.xy`. Scaling the texture coordinate information according to this parameter is expressed as `IN.TexCoord.xy*Disturb.xy`, meaning the scaling operation related to the second scaling parameter is multiplied by it. The second offset parameter is also a two-dimensional parameter, represented by `Disturb.zw`. The second offset consists of the second offset parameter and time information, and can be represented as `Disturb.zw*TIME`, where `TIME` represents the time information. Offsetting the texture coordinate information according to this parameter is expressed as `IN.TexCoord.xy+Disturb.zw*TIME`, meaning the offset operation related to the second offset parameter is added to it.
[0143] In one example, the texture coordinate information of the target model is scaled according to the second scaling parameter and offset according to the second offset to obtain the fifth texture coordinate information, which can be expressed as: flowTC5 = IN.TexCoord.xy * Disturb.xy + Disturb.zw * TIME, where flowTC5 represents the fifth texture coordinate information, that is, the fifth texture coordinate information is equal to the texture coordinate information multiplied by the second scaling parameter and then added to the first offset, so that the fifth texture coordinate information can change with time. Correspondingly, the third sampling result obtained by sampling the fourth channel map according to the fifth texture coordinate information will also change with time.
[0144] The above-mentioned sampling process, based on the fifth texture coordinate information, of the fourth channel texture to obtain the third sampling result can be expressed as: AlphaTex = tCarDetailMap.SampleBias(sCarDetailMapSampler, flowTC5, SampleMipBias).a, where AlphaTex represents the third sampling result. In other words, the third sampling result can be considered as the result of scaling the fourth channel texture over time, with the scaling degree determined by the second scaling parameter, and the movement speed and direction determined by the second offset parameter.
[0145] Since the fourth channel texture is used to store black and white information, the third sampling result obtained by sampling the fourth channel texture can be represented as the third black and white texture.
[0146] The parallax offset texture coordinate information can be represented by offset, which is obtained by parallax offsetting the texture coordinate information. It can be understood that the parallax offset texture coordinate information is related to the texture coordinate information and the viewing angle.
[0147] The sixth texture coordinate information, determined based on the third sampling result and the disparity offset texture coordinate information, can be expressed as offset + AlphaTex. That is, the sixth texture coordinate information is obtained by adding the third sampling result to the disparity offset texture coordinate information. Since the third sampling result can change over time, and the disparity offset texture coordinate information can change with the viewing angle, the obtained sixth texture coordinate information changes both over time and with the viewing angle. Accordingly, sampling the color channel texture based on the sixth texture coordinate information will also result in sampling results that change over time and with the viewing angle.
[0148] Since color channel maps are used to store color information, the image sampled from the color channel map at this time is also in color; that is, the dynamic map corresponding to the fourth rendering option is in color.
[0149] Specifically, the color channel texture is sampled based on the sixth texture coordinate information to obtain the dynamic texture corresponding to the fourth rendering option, which can be represented as: colorTex = tCarDetailMap.SampleBias(sCarDetailMapSampler, offset + AlphaTex, SampleMipBias).rgba, where colorTex represents the result of sampling the color channel texture, i.e., the colored dynamic texture.
[0150] In one optional example, the process of generating disparity offset texture coordinate information may include:
[0151] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0152] Obtain the tangent direction, subtangent direction, and view direction of each pixel in the target model;
[0153] Based on the tangent direction, the subtangent direction, the viewing angle direction, and the disparity depth control parameters, the disparity offset information is determined.
[0154] Based on the disparity offset information and the first texture coordinate information, disparity offset texture coordinate information is generated.
[0155] The process of obtaining the first texture coordinate information in this example is similar to the process of obtaining the first texture coordinate information by the rendering algorithm corresponding to the first rendering option. Please refer to the description of the previous embodiment for details, which will not be repeated here.
[0156] The rendering process of a target model is the process of projecting a 3D target model into a 2D target model image. Pixels of the target model refer to the pixels that make up the target model image. Therefore, the position of the target model corresponding to each pixel can be determined. Then, the tangent and normal can be obtained from the corresponding positions, and the secondary tangent can be calculated based on the tangent and normal. The viewpoint direction can be determined based on the relative positional relationship between the target model and the virtual camera. It can be understood that the viewpoint direction of each pixel in world space is the viewpoint direction of the virtual camera in the game.
[0157] The parallax depth control parameter is used to control the viewing angle depth. It can be understood that the parallax depth control parameter is used to control the distance between the original texture coordinate information and the corresponding texture coordinate information after parallax offset in the direction perpendicular to the screen.
[0158] Based on the tangent direction, the subtangent direction, the view direction, and the disparity depth control parameter, disparity offset information is determined. This disparity offset information can be represented as float2(dot(Tangent,View),dot(Bitangent,View))*HoleDepth, where Tangent represents the unit vector in the tangent direction (i.e., the tangent line); View represents the unit vector in the view direction (i.e., the view angle); Bitangent represents the unit vector in the subtangent direction (i.e., the subtangent line); dot represents dot product; HoleDepth represents the disparity depth control parameter; and float2 represents a two-dimensional data type.
[0159] Based on the parallax offset information and the first texture coordinate information, parallax offset texture coordinate information is generated, which can be expressed as: offset = float2(dot(Tangent,View), dot(Bitangent,View)) * HoleDepth + flowTC1, where offset represents the parallax offset texture coordinate information and flowTC1 represents the first texture coordinate information. Using the parallax offset texture coordinate information, the final dynamic effect can have a three-dimensional feel, i.e., produce a parallax effect. Figure 13 The diagram shows a dynamic texture generated using the target rendering algorithm corresponding to the fourth rendering option in an example of this application. In this embodiment, the principle of parallax is to interpolate the pixels in world coordinates to offset the pixels in model texture coordinates. This creates the illusion that a pixel appears at point A, but the human eye sees it at point B.
[0160] For example, the calculation process for the above-mentioned positive tangent direction and negative tangent direction may include:
[0161] Determine the first distance between adjacent pixels of the target model in the world coordinate system and the second distance in the texture space;
[0162] The positional offset in texture space is determined based on the first distance and the second distance;
[0163] The tangent and secondary tangent are determined based on the positional offset in texture space.
[0164] The WorldPosition system defines the objective space of physical position. The difference in coordinates between two adjacent pixels can be calculated using ddx (world coordinates worldPostition.xyz) and ddy (world coordinates WorldPosition.xyz). GPUs typically use 2x2 units for pixelation, such as... Figure 14In the four pixels shown, ddx(p(x,y)) calculates the x-coordinate of the pixel to its right minus the x-coordinate of the pixel to its left. Similarly, ddy calculates the interpolation of the y-coordinate. They calculate the distance between two adjacent pixels in the world coordinate system.
[0165] Using P and Q to represent the difference between pixels in world coordinates, we can obtain:
[0166] Float3 P=ddx(WorldPosition.xyz);
[0167] Float3 Q=ddy(WorldPosition.xyz);
[0168] Float3 represents a three-dimensional data type.
[0169] After scaling and offsetting the texture coordinate information of the target model, the first texture coordinate information is obtained, which can be represented as: flowTC1 = IN.TexCoord.xy * DetailUV.xy + DetailUV.zw * TIME.
[0170] Using C and D to represent the pixel difference of flowTC1 in texture space, we can obtain:
[0171] Float2 C = ddx(detailUV);
[0172] Float2 D = ddy(detailUV);
[0173] Float2 represents a two-dimensional data type.
[0174] Using the distance formula p = root square((x1-x2)2+(y1-y2)2), we can obtain the texture space position offset: R = Cy*Dx-Dy*Cx; where Cy represents the second term in the two-dimensional data C, and Cx represents the first term in the two-dimensional data C. Similarly, Dx represents the first term in the two-dimensional data D, and Dy represents the second term in the two-dimensional data D.
[0175] The texture space offset is standardized by limiting the range of R to between 0 and 1, i.e., R = rcp(Cy*Dx - Dy*Cx).
[0176] Finally, the coordinate directions of the tangent and subtangent spaces are needed to construct the disparity matrix, transform it from tangent space to world space, add the disparity direction from world space to texture space, and finally sample pixels using texture space to obtain the disparity. That is, after disparity transformation, the obtained pixel is not actually the pixel of the vertex corresponding to the current rasterization.
[0177] The x and y axes of the texture space are constructed using tangents and secondary tangents, while the virtual camera's viewpoint direction is the z-axis. The depth of the z-axis is represented by the parallax depth control parameter, thus yielding the tangent and secondary tangent, as follows:
[0178] Float3 Tangent=-(P*Dy-Q*Cy)*R;
[0179] Float3 Bitangent=(P*Dx-Q*Cx)*R.
[0180] Furthermore, considering that the requirements for the display effect of the model may vary in different scenarios during the game, for example, the model is required to have the highest number of polygons and the best material effects on the model display page, while when the model is in motion, such as when the racing car model is driving in the lane, in order to optimize performance and reduce the amount of computation, the requirements for the display effect of the model are lower than those for the display effect on the display page.
[0181] To enhance the model's performance, in some optional embodiments of this application, the scaling of the texture coordinate information of the target model according to the second scaling parameter and the offsetting of the texture coordinate information according to the second offset to obtain the fifth texture coordinate information may further include:
[0182] The fifth texture coordinate information is offset based on the disparity information to update the fifth texture coordinate information; the disparity information is obtained based on the viewpoint direction and normal direction of each pixel of the target model, as well as the distortion intensity control parameters.
[0183] The disparity information is obtained based on the viewing direction and normal direction of each pixel in the target model, as well as the distortion intensity control parameters. It can be understood that the disparity information is related to the viewing direction, normal direction, and distortion intensity control parameters of the pixel.
[0184] For example, the parallax information can be represented as saturate(NoV)*TwistStrength, where saturate(NoV) represents the standardization of the dot product of the normal and the view direction, and TwistStrength represents the twist strength control parameter.
[0185] Offsetting the fifth texture coordinate information based on parallax information can mean adding parallax information to the fifth texture coordinate information. The updated fifth texture coordinate information can be expressed as IN.TexCoord.xy*Disturb.xy+Disturb.zw*TIME+saturate(NoV)*TwistStrength, that is, the updated fifth texture coordinate information is equal to the texture coordinate information multiplied by the second scaling parameter, then added to the first offset and the parallax information, so that the updated fifth texture coordinate information can change with the viewing angle. Correspondingly, the fourth channel texture is sampled based on the updated fifth texture coordinate information, and the resulting third sampling result will also change with the viewing angle, thereby enhancing the display effect of the dynamic texture obtained by the fourth rendering option.
[0186] Furthermore, to enhance the model's performance, in some optional embodiments of this application, the determination of the sixth texture coordinate information based on the third sampling result and the disparity offset texture coordinate information may further include:
[0187] The third sampling result is adjusted using the disparity intensity control parameter to update the third sampling result;
[0188] The sixth texture coordinate information is determined based on the updated third sampling result and the disparity offset texture coordinate information.
[0189] The parallax intensity control parameter can be represented by NovStrength and can be obtained through the corresponding parameter options. The third sampling result is adjusted using the parallax intensity control parameter to update the third sampling result, which can be expressed as AlphaTex*NovStrength. It can be seen that the parallax intensity control parameter is used to adjust the brightness of the third sampling result.
[0190] The sixth texture coordinate information, determined based on the updated third sampling result and disparity offset texture coordinate information, can be expressed as offset + AlphaTex * NovStrength. That is, the sixth texture coordinate information is obtained by multiplying the third sampling result by the disparity intensity control parameter and then adding it to the disparity offset texture coordinate information. This allows the sixth texture coordinate information to be controlled by the disparity intensity control parameter, and the diversity of dynamic textures can be further improved by adjusting the disparity intensity control parameter.
[0191] This embodiment uses the rendering algorithm corresponding to the fourth rendering option to perform two sampling processes on the element texture. It also incorporates parallax, so that the effect of the generated dynamic texture can not only change with time and parameters, but also with the viewing angle. The rendering algorithm corresponding to the fourth rendering option in this embodiment is particularly suitable for top-level painting and can be integrated with static car painting designs and other scenes to achieve a three-dimensional and transparent artistic effect.
[0192] Furthermore, to enhance the visual impact of the fourth channel texture in terms of color representation, in some optional embodiments of this application, the contrast can be enhanced by exponentiation, specifically by controlling the exponentiation through brightness control parameters. To save parameters and optimize performance, the panel color picker can be multiplied by 30. This results in a brightness value of 1*30 (30) when white is selected, and 0*30 (0) when black is selected. This can be represented as: BaseColorDetail = pow(ColorTex*cCarDetailColor*30, cDiffColRange), where BaseColorDetail represents the base color of the element texture, pow() represents the exponentiation operation, ColorTex represents the fourth channel texture color, CarDetailColor represents the panel color picker color, and cDiffColRange represents the color range parameter.
[0193] Similarly, to save parameters, the BaseColor parameter can also be pre-multiplied by 30, and finally the grayscale value of the fourth channel texture can be used to control the mixing of linear interpolation. Specifically, it can be expressed as: PaintColor = lerp((ColorTex*cBaseColor*30), BaseColorDetail, AlphaTex).
[0194] In this embodiment, the first scaling parameter, the first offset parameter, the second scaling parameter, the second offset parameter, the parallax depth control parameter, the distortion intensity control parameter, the parallax intensity control parameter, and the heterochromatic range parameter can all be set by the system default or by the user. The user-defined settings include modifying the system default parameters, which can be referred to in the previous description and will not be repeated here.
[0195] The rendering algorithm corresponding to the fourth rendering option involves several parameters during the processing of element textures to obtain dynamic textures, including the first scaling parameter, the first offset parameter, the second scaling parameter, the second offset parameter, the parallax depth control parameter, the distortion intensity control parameter, the parallax intensity control parameter, and the heterochromatic range parameter. Compared to the rendering algorithms corresponding to the first and second rendering options, it requires more parameters. In a graphical user interface, increasing the number of parameters means increased memory bandwidth and GPU (Graphics Processing Unit) computational load. To address this issue, the inventors devised a method to reasonably compress the parameters, using the fewest possible panel parameters to cover the required actual parameters, thereby achieving performance optimization. Considering that the brightness control parameter controlling the exponent does not require decimal precision, while the parallax depth control parameter can express a significant difference with a change of 0.01 units, the brightness control parameter and the parallax depth control parameter can be merged. Specifically, a single parameter input box can be used to represent both parameters. Specifically, the real number portion of the corresponding parameter input box can be used as the brightness control parameter, and the decimal portion as the parallax depth control parameter.
[0196] Similarly, the torsion intensity control parameter and the disparity intensity control parameter are combined, and the disparity intensity control parameter is represented by the tenths place in the corresponding parameter input box, and the torsion intensity control parameter is represented by the hundredths place.
[0197] This application discloses four rendering algorithms. Each algorithm processes at least two channels of the element texture map. During the sampling of one of the dynamic texture maps storing dynamic elements to obtain the dynamic texture map, the sampling results of other channel texture maps influence the process. This allows for the creation of diverse dynamic effects for dynamic elements using a single element texture map, saving texture resources and storage space, and improving the efficiency of dynamic effect generation. Furthermore, by integrating the four rendering algorithms into a single graphical user interface, users can easily use different rendering algorithms to generate models with different dynamic effects, further improving the efficiency of dynamic effect generation.
[0198] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this application.
[0199] Reference Figure 15This diagram illustrates a structural block diagram of an embodiment of a dynamic effect model rendering apparatus according to this application. Corresponding to the above-described embodiment of a dynamic effect model rendering method, in this embodiment, the dynamic effect model rendering apparatus displays a graphical user interface on the display screen of a terminal device by running an application. The graphical user interface includes multiple different rendering options. The dynamic effect model rendering apparatus may include the following modules:
[0200] The rendering method determination module 1501 is used to obtain the element texture of the target model to be rendered in response to the start operation for the target rendering option. The target rendering option is any one of the multiple different rendering options, and the element texture is used to determine the dynamic elements of the target model.
[0201] The dynamic texture generation module 1502 is used to process the element texture using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, wherein the dynamic texture contains the relationship between the position of the dynamic element and the change over time.
[0202] The dynamic effect rendering module 1503 is used to render the target model based on the dynamic texture to obtain the dynamic effect of the target model.
[0203] Furthermore, the dynamic effect rendering module 1503 may also include:
[0204] The acquisition submodule is used to acquire the original texture map and dynamic mask of the target model; each pixel in the dynamic mask is used to determine the fusion weight between each pixel of the original texture map and the corresponding pixel of the dynamic map;
[0205] The fusion submodule is used to fuse the original texture map and the dynamic map according to the dynamic mask to obtain a fused texture map;
[0206] The rendering submodule is used to render the dynamic region based on the fused texture to obtain the dynamic effect of the target model.
[0207] Furthermore, the device may also include:
[0208] The color acquisition module is used to acquire the element colors of the target model; the element colors are used to adjust the colors of the dynamic elements.
[0209] The color mixing module is used to process the dynamic texture according to the element color in order to update the dynamic texture.
[0210] Furthermore, the element texture includes a first channel texture and a second channel texture. When the target rendering option is the first rendering option, the dynamic texture generation module 1502 may include:
[0211] The first coordinate determination submodule is used to scale the texture coordinate information of the target model according to the first scaling parameter, and to offset the texture coordinate information according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0212] The first sampling submodule is used to perform sampling processing on the first channel texture based on the first texture coordinate information to obtain the first sampling result;
[0213] The second coordinate determination submodule is used to scale the texture coordinate information according to the second scaling parameter and the first sampling result, and to offset the texture coordinate information according to the second offset to obtain the second texture coordinate information; the second offset is obtained according to the second offset parameter and time information.
[0214] The first generation submodule is used to sample the second channel texture based on the third texture coordinate information to obtain the dynamic texture corresponding to the first rendering option.
[0215] Furthermore, the element texture includes a first channel texture and a second channel texture. When the target rendering option is the second rendering option, the dynamic texture generation module 1502 may include:
[0216] The first coordinate determination submodule is used to scale the texture coordinate information of the target model according to the first scaling parameter, and to offset the texture coordinates according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0217] The first sampling submodule is used to perform sampling processing on the first channel texture based on the first texture coordinate information to obtain the first sampling result;
[0218] The third coordinate determination submodule is used to scale the texture coordinate information according to the second scaling parameter, and to offset the texture coordinate information according to the second offset and perturbation information to obtain the third texture coordinate information; the second offset is obtained according to the second offset parameter and time information; the perturbation information is obtained according to the perturbation intensity control parameter and the first sampling result;
[0219] The second generation submodule is used to sample the second channel texture based on the third texture coordinate information to obtain the dynamic texture corresponding to the second rendering option.
[0220] Furthermore, the element texture includes a color channel texture and a fourth channel texture. When the target rendering option is the third rendering option, the dynamic texture generation module 1502 may include:
[0221] The first coordinate determination submodule is used to scale the texture coordinate information of the target model according to the first scaling parameter, and to offset the texture coordinate information according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0222] The second sampling submodule is used to sample the fourth channel texture based on the first texture coordinate information to obtain a second sampling result.
[0223] The fourth coordinate determination submodule is used to scale the texture coordinate information according to the scrolling information and the second scaling parameter, and to offset the texture coordinate information according to the second offset and the distortion information to obtain the fourth texture coordinate information; the scrolling information is obtained according to the second sampling result and the scrolling intensity control parameter, the second offset is obtained according to the second offset parameter and the time information, and the distortion information is obtained according to the second sampling result and the distortion intensity control parameter;
[0224] The third generation submodule is used to sample the color channel texture based on the fourth texture coordinate information to obtain the dynamic texture corresponding to the third rendering option.
[0225] Furthermore, the element texture includes a color channel texture and a fourth channel texture. When the target rendering option is the fourth rendering option, the dynamic texture generation module 1502 may include:
[0226] The fifth coordinate determination submodule is used to scale the texture coordinate information of the target model according to the second scaling parameter, and offset the texture coordinate information according to the second offset to obtain the fifth texture coordinate information; the second offset is obtained according to the second offset parameter and time information;
[0227] The third sampling submodule is used to sample the fourth channel texture based on the fifth texture coordinate information to obtain the third sampling result.
[0228] The sixth coordinate determination submodule is used to determine the sixth texture coordinate information based on the third sampling result and the disparity offset texture coordinate information, wherein the disparity offset texture coordinate information is obtained by disparity offsetting the texture coordinate information;
[0229] The fourth generation submodule is used to sample the color channel texture based on the sixth texture coordinate information to obtain the dynamic texture corresponding to the fourth rendering option.
[0230] Furthermore, the fifth coordinate determination submodule can also be used to offset the fifth texture coordinate information according to the disparity information in order to update the fifth texture coordinate information; the disparity information is obtained according to the viewing direction and normal direction of each pixel of the target model, as well as the distortion intensity control parameters.
[0231] Furthermore, the sixth coordinate determination submodule may also include:
[0232] The third sampling update unit is used to adjust the third sampling result using disparity intensity control parameters to update the third sampling result;
[0233] The sixth coordinate determination unit is used to determine the sixth texture coordinate information based on the updated third sampling result and the disparity offset texture coordinate information.
[0234] Furthermore, when the target rendering option is the fourth rendering option, the dynamic texture generation module 1502 may further include:
[0235] The first coordinate generation submodule is used to scale the texture coordinate information of the target model according to the first scaling parameter, and to offset the texture coordinate information according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0236] The view acquisition submodule is used to acquire the tangent direction, subtangent direction and view direction of each pixel of the target model;
[0237] The disparity offset determination submodule is used to determine disparity offset information based on the positive tangent direction, the secondary tangent direction, the viewing angle direction, and the disparity depth control parameters.
[0238] The disparity offset coordinate generation submodule is used to generate disparity offset texture coordinate information based on the disparity offset information and the first texture coordinate information.
[0239] Furthermore, the graphical user interface includes multiple parameter options, which at least include a first scaling parameter option, a first offset parameter option, a second scaling parameter option, and a second offset parameter option; each parameter option has a corresponding parameter input box, and the device may further include:
[0240] A parameter update module is used to determine the new parameter corresponding to the adjustment operation in response to an adjustment operation on at least one of the parameters in the parameter input box;
[0241] The texture update module is used to process the element texture based on the new parameters and the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture.
[0242] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0243] This application also discloses an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the steps of a model rendering method with dynamic effects as described above, such as displaying a graphical user interface, which includes multiple different rendering options.
[0244] In response to the start operation for the target rendering option, obtain the element texture of the target model to be rendered. The target rendering option is any one of several different rendering options. The element texture is used to determine the dynamic elements of the target model.
[0245] The element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, which contains the relationship between the position of the dynamic element and the time.
[0246] The target model is rendered using dynamic textures to obtain its dynamic effects.
[0247] Optionally, rendering the target model based on dynamic textures to obtain the dynamic effect of the target model also includes:
[0248] Obtain the original texture map and dynamic mask of the target model; each pixel in the dynamic mask is used to determine the fusion weight between each pixel in the original texture map and the corresponding pixel in the dynamic map;
[0249] The original texture map and the dynamic texture map are blended together based on the dynamic mask to obtain the blended texture map;
[0250] Dynamic areas are rendered using blended textures to obtain the dynamic effect of the target model.
[0251] Optionally, the method further includes:
[0252] Get the element colors of the target model; element colors are used to adjust the colors of dynamic elements;
[0253] The dynamic texture is processed based on the element's color to update the dynamic texture.
[0254] Optionally, the element texture includes a first channel texture and a second channel texture. When the target rendering option is the first rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including:
[0255] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0256] The first channel texture is sampled based on the first texture coordinate information to obtain the first sampling result;
[0257] The texture coordinate information is scaled according to the second scaling parameter and the first sampling result, and the texture coordinate information is offset according to the second offset to obtain the second texture coordinate information; the second offset is obtained according to the second offset parameter and time information.
[0258] The second channel texture is sampled based on the third texture coordinate information to obtain the dynamic texture corresponding to the first rendering option.
[0259] Optionally, the element texture includes a first channel texture and a second channel texture. When the target rendering option is the second rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including:
[0260] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinates are offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0261] The first channel texture is sampled based on the first texture coordinate information to obtain the first sampling result;
[0262] The texture coordinate information is scaled according to the second scaling parameter, and offset according to the second offset and perturbation information to obtain the third texture coordinate information; the second offset is obtained according to the second offset parameter and time information; the perturbation information is obtained according to the perturbation intensity control parameter and the first sampling result.
[0263] The second channel texture is sampled based on the third texture coordinate information to obtain the dynamic texture corresponding to the second rendering option.
[0264] Optionally, the element texture includes a color channel texture and a fourth channel texture. When the target rendering option is the third rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including:
[0265] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0266] The fourth channel texture is sampled based on the first texture coordinate information to obtain the second sampling result;
[0267] The texture coordinate information is scaled based on the scrolling information and the second scaling parameter, and offset based on the second offset and the distortion information to obtain the fourth texture coordinate information; the scrolling information is obtained based on the second sampling result and the scrolling intensity control parameter, the second offset is obtained based on the second offset parameter and the time information, and the distortion information is obtained based on the second sampling result and the distortion intensity control parameter.
[0268] The color channel texture is sampled based on the fourth texture coordinate information to obtain the dynamic texture corresponding to the third rendering option.
[0269] Optionally, the element texture includes a color channel texture and a fourth channel texture. When the target rendering option is the fourth rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including:
[0270] The texture coordinate information of the target model is scaled according to the second scaling parameter, and the texture coordinate information is offset according to the second offset to obtain the fifth texture coordinate information; the second offset is obtained based on the second offset parameter and time information.
[0271] The fourth channel texture is sampled based on the fifth texture coordinate information to obtain the third sampling result;
[0272] The sixth texture coordinate information is determined based on the third sampling result and the disparity offset texture coordinate information, wherein the disparity offset texture coordinate information is obtained by disparity offsetting the texture coordinate information;
[0273] The color channel texture is sampled based on the sixth texture coordinate information to obtain the dynamic texture corresponding to the fourth rendering option.
[0274] Optionally, scaling the texture coordinate information of the target model according to the second scaling parameter and offsetting the texture coordinate information according to the second offset to obtain the fifth texture coordinate information further includes:
[0275] The fifth texture coordinate information is offset based on the disparity information to update the fifth texture coordinate information; the disparity information is obtained based on the view direction and normal direction of each pixel of the target model, as well as the distortion intensity control parameters.
[0276] Optionally, determining the sixth texture coordinate information based on the third sampling result and the disparity offset texture coordinate information further includes:
[0277] The third sampling result is updated by adjusting the parallax intensity control parameter.
[0278] The sixth texture coordinate information is determined based on the updated third sampling result and the disparity offset texture coordinate information.
[0279] Optionally, before obtaining the sixth texture coordinate information, the method further includes:
[0280] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0281] Obtain the tangent direction, subtangent direction, and view direction of each pixel in the target model;
[0282] The disparity offset information is determined based on the tangent direction, subtangent direction, viewing angle direction, and disparity depth control parameters.
[0283] Based on the disparity offset information and the first texture coordinate information, disparity offset texture coordinate information is generated.
[0284] Optionally, the graphical user interface includes multiple parameter options, which at least include a first scaling parameter option, a first offset parameter option, a second scaling parameter option, and a second offset parameter option; each parameter option has a corresponding parameter input box, and the method further includes:
[0285] In response to an adjustment operation on a parameter in at least one parameter input box, determine the new parameter corresponding to the adjustment operation;
[0286] Based on the new parameters, the target rendering algorithm corresponding to the target rendering option is used to process the element textures to obtain the corresponding dynamic textures.
[0287] This application also discloses a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of a model rendering method with dynamic effects as described above, such as displaying a graphical user interface including multiple different rendering options.
[0288] In response to the start operation for the target rendering option, obtain the element texture of the target model to be rendered. The target rendering option is any one of several different rendering options. The element texture is used to determine the dynamic elements of the target model.
[0289] The element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, which contains the relationship between the position of the dynamic element and the time.
[0290] The target model is rendered using dynamic textures to obtain its dynamic effects.
[0291] Optionally, rendering the target model based on dynamic textures to obtain the dynamic effect of the target model also includes:
[0292] Obtain the original texture map and dynamic mask of the target model; each pixel in the dynamic mask is used to determine the fusion weight between each pixel in the original texture map and the corresponding pixel in the dynamic map;
[0293] The original texture map and the dynamic texture map are blended together based on the dynamic mask to obtain the blended texture map;
[0294] Dynamic areas are rendered using blended textures to obtain the dynamic effect of the target model.
[0295] Optionally, the method further includes:
[0296] Get the element colors of the target model; element colors are used to adjust the colors of dynamic elements;
[0297] The dynamic texture is processed based on the element's color to update the dynamic texture.
[0298] Optionally, the element texture includes a first channel texture and a second channel texture. When the target rendering option is the first rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including:
[0299] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0300] The first channel texture is sampled based on the first texture coordinate information to obtain the first sampling result;
[0301] The texture coordinate information is scaled according to the second scaling parameter and the first sampling result, and the texture coordinate information is offset according to the second offset to obtain the second texture coordinate information; the second offset is obtained according to the second offset parameter and time information.
[0302] The second channel texture is sampled based on the third texture coordinate information to obtain the dynamic texture corresponding to the first rendering option.
[0303] Optionally, the element texture includes a first channel texture and a second channel texture. When the target rendering option is the second rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including:
[0304] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinates are offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0305] The first channel texture is sampled based on the first texture coordinate information to obtain the first sampling result;
[0306] The texture coordinate information is scaled according to the second scaling parameter, and offset according to the second offset and perturbation information to obtain the third texture coordinate information; the second offset is obtained according to the second offset parameter and time information; the perturbation information is obtained according to the perturbation intensity control parameter and the first sampling result.
[0307] The second channel texture is sampled based on the third texture coordinate information to obtain the dynamic texture corresponding to the second rendering option.
[0308] Optionally, the element texture includes a color channel texture and a fourth channel texture. When the target rendering option is the third rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including:
[0309] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0310] The fourth channel texture is sampled based on the first texture coordinate information to obtain the second sampling result;
[0311] The texture coordinate information is scaled based on the scrolling information and the second scaling parameter, and offset based on the second offset and the distortion information to obtain the fourth texture coordinate information; the scrolling information is obtained based on the second sampling result and the scrolling intensity control parameter, the second offset is obtained based on the second offset parameter and the time information, and the distortion information is obtained based on the second sampling result and the distortion intensity control parameter.
[0312] The color channel texture is sampled based on the fourth texture coordinate information to obtain the dynamic texture corresponding to the third rendering option.
[0313] Optionally, the element texture includes a color channel texture and a fourth channel texture. When the target rendering option is the fourth rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including:
[0314] The texture coordinate information of the target model is scaled according to the second scaling parameter, and the texture coordinate information is offset according to the second offset to obtain the fifth texture coordinate information; the second offset is obtained based on the second offset parameter and time information.
[0315] The fourth channel texture is sampled based on the fifth texture coordinate information to obtain the third sampling result;
[0316] The sixth texture coordinate information is determined based on the third sampling result and the disparity offset texture coordinate information, wherein the disparity offset texture coordinate information is obtained by disparity offsetting the texture coordinate information;
[0317] The color channel texture is sampled based on the sixth texture coordinate information to obtain the dynamic texture corresponding to the fourth rendering option.
[0318] Optionally, scaling the texture coordinate information of the target model according to the second scaling parameter and offsetting the texture coordinate information according to the second offset to obtain the fifth texture coordinate information further includes:
[0319] The fifth texture coordinate information is offset based on the disparity information to update the fifth texture coordinate information; the disparity information is obtained based on the view direction and normal direction of each pixel of the target model, as well as the distortion intensity control parameters.
[0320] Optionally, determining the sixth texture coordinate information based on the third sampling result and the disparity offset texture coordinate information further includes:
[0321] The third sampling result is adjusted using the parallax intensity control parameter to update the third sampling result;
[0322] The sixth texture coordinate information is determined based on the updated third sampling result and the disparity offset texture coordinate information.
[0323] Optionally, before obtaining the sixth texture coordinate information, the method further includes:
[0324] The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information.
[0325] Obtain the tangent direction, subtangent direction, and view direction of each pixel in the target model;
[0326] The disparity offset information is determined based on the tangent direction, subtangent direction, viewing angle direction, and disparity depth control parameters.
[0327] Based on the disparity offset information and the first texture coordinate information, disparity offset texture coordinate information is generated.
[0328] Optionally, the graphical user interface includes multiple parameter options, which at least include a first scaling parameter option, a first offset parameter option, a second scaling parameter option, and a second offset parameter option; each parameter option has a corresponding parameter input box, and the method further includes:
[0329] In response to an adjustment operation on a parameter in at least one parameter input box, determine the new parameter corresponding to the adjustment operation;
[0330] Based on the new parameters, the target rendering algorithm corresponding to the target rendering option is used to process the element textures to obtain the corresponding dynamic textures.
[0331] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0332] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0333] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0334] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0335] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0336] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0337] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0338] The above provides a detailed description of a dynamic effect model rendering method, apparatus, electronic device, and storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for rendering models with dynamic effects, characterized in that, By running an application, a graphical user interface is displayed on the screen of a terminal device, the graphical user interface including multiple different rendering options, the method comprising: In response to a startup operation for a target rendering option, an element texture map of the target model to be rendered is obtained, wherein the target rendering option is any one of the plurality of different rendering options, and the element texture map is used to determine the dynamic elements of the target model; The element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain a corresponding dynamic texture. The dynamic texture contains the relationship between the position of the dynamic element and the change over time. The element texture includes multiple channel textures. The target model is rendered based on the dynamic texture to obtain the dynamic effect of the target model; The step of processing the element texture using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture includes: The texture coordinate information of the target model is scaled according to the scaling parameters, and the texture coordinate information is offset according to the offset amount to obtain the processed texture coordinate information; the offset amount is obtained based on the offset parameters and time information. The channel map is sampled based on the processed texture coordinate information to obtain the dynamic map corresponding to the target rendering option.
2. The method according to claim 1, characterized in that, The step of rendering the target model based on the dynamic texture to obtain the dynamic effect of the target model further includes: Obtain the original texture map and dynamic mask of the target model; each pixel in the dynamic mask is used to determine the fusion weight between each pixel of the original texture map and the corresponding pixel of the dynamic map; The original texture map and the dynamic texture map are fused according to the dynamic mask to obtain a fused texture map; The dynamic region is rendered based on the fused texture to obtain the dynamic effect of the target model.
3. The method according to claim 2, characterized in that, The method further includes: Obtain the element colors of the target model; the element colors are used to adjust the colors of the dynamic elements; The dynamic texture is processed according to the element color to update the dynamic texture.
4. The method according to claim 3, characterized in that, The element texture includes a first channel texture and a second channel texture. When the target rendering option is the first rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including: The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information. The first channel texture is sampled based on the first texture coordinate information to obtain the first sampling result; The texture coordinate information is scaled according to the second scaling parameter and the first sampling result, and offset according to the second offset to obtain the second texture coordinate information; the second offset is obtained according to the second offset parameter and time information. The second channel texture is sampled based on the second texture coordinate information to obtain the dynamic texture corresponding to the first rendering option.
5. The method according to claim 3, characterized in that, The element texture includes a first channel texture and a second channel texture. When the target rendering option is the second rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including: The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinates are offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information. The first channel texture is sampled based on the first texture coordinate information to obtain the first sampling result; The texture coordinate information is scaled according to the second scaling parameter, and offset according to the second offset and perturbation information to obtain the third texture coordinate information; the second offset is obtained according to the second offset parameter and time information; the perturbation information is obtained according to the perturbation intensity control parameter and the first sampling result; The second channel texture is sampled based on the third texture coordinate information to obtain the dynamic texture corresponding to the second rendering option.
6. The method according to claim 3, characterized in that, The element texture includes a color channel texture and a fourth channel texture. When the target rendering option is the third rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including: The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information. The fourth channel texture is sampled based on the first texture coordinate information to obtain a second sampling result; The texture coordinate information is scaled according to the scrolling information and the second scaling parameter, and offset according to the second offset and the distortion information to obtain the fourth texture coordinate information; the scrolling information is obtained according to the second sampling result and the scrolling intensity control parameter, the second offset is obtained according to the second offset parameter and the time information, and the distortion information is obtained according to the second sampling result and the distortion intensity control parameter. The color channel texture is sampled based on the fourth texture coordinate information to obtain the dynamic texture corresponding to the third rendering option.
7. The method according to claim 3, characterized in that, The element texture includes a color channel texture and a fourth channel texture. When the target rendering option is the fourth rendering option, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture, including: The texture coordinate information of the target model is scaled according to the second scaling parameter, and the texture coordinate information is offset according to the second offset to obtain the fifth texture coordinate information; the second offset is obtained according to the second offset parameter and time information. The fourth channel texture is sampled based on the fifth texture coordinate information to obtain the third sampling result; The sixth texture coordinate information is determined based on the third sampling result and the disparity offset texture coordinate information, wherein the disparity offset texture coordinate information is obtained by disparity offsetting the texture coordinate information; The color channel texture is sampled based on the sixth texture coordinate information to obtain the dynamic texture corresponding to the fourth rendering option.
8. The method according to claim 7, characterized in that, The step of scaling the texture coordinate information of the target model according to the second scaling parameter and offsetting the texture coordinate information according to the second offset to obtain the fifth texture coordinate information further includes: The fifth texture coordinate information is offset based on the disparity information to update the fifth texture coordinate information; the disparity information is obtained based on the viewpoint direction and normal direction of each pixel of the target model, as well as the distortion intensity control parameters.
9. The method according to claim 7, characterized in that, The step of determining the sixth texture coordinate information based on the third sampling result and the disparity offset texture coordinate information further includes: The third sampling result is adjusted using the disparity intensity control parameter to update the third sampling result; The sixth texture coordinate information is determined based on the updated third sampling result and the disparity offset texture coordinate information.
10. The method according to any one of claims 7-9, characterized in that, Before obtaining the sixth texture coordinate information, the method further includes: The texture coordinate information of the target model is scaled according to the first scaling parameter, and the texture coordinate information is offset according to the first offset to obtain the first texture coordinate information; the first offset is obtained according to the first offset parameter and time information. Obtain the tangent direction, subtangent direction, and view direction of each pixel in the target model; Based on the tangent direction, the subtangent direction, the viewing angle direction, and the disparity depth control parameters, the disparity offset information is determined. Based on the disparity offset information and the first texture coordinate information, disparity offset texture coordinate information is generated.
11. The method according to any one of claims 1-9, characterized in that, The graphical user interface includes multiple parameter options, including at least a first scaling parameter option, a first offset parameter option, a second scaling parameter option, and a second offset parameter option; Each parameter option has a corresponding parameter input box, and the method further includes: In response to an adjustment operation on at least one of the parameters in the parameter input boxes, a new parameter corresponding to the adjustment operation is determined; Based on the new parameters, the element texture is processed using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture.
12. A model rendering device with dynamic effects, characterized in that, By running an application, a graphical user interface is displayed on the screen of a terminal device. The graphical user interface includes multiple different rendering options. The device comprises: The rendering method determination module is used to obtain the element texture of the target model to be rendered in response to the start operation for the target rendering option. The target rendering option is any one of the multiple different rendering options, and the element texture is used to determine the dynamic elements of the target model. The dynamic texture generation module is used to process the element texture using the target rendering algorithm corresponding to the target rendering option to obtain the corresponding dynamic texture. The dynamic texture contains the relationship between the position of the dynamic element and the change over time. The element texture includes multiple channel textures. The dynamic effect rendering module is used to render the target model based on the dynamic texture to obtain the dynamic effect of the target model; The dynamic texture generation module is further configured to scale the texture coordinate information of the target model according to the scaling parameters, and offset the texture coordinate information according to the offset amount to obtain the processed texture coordinate information; the offset amount is obtained based on the offset parameters and time information. The channel map is sampled based on the processed texture coordinate information to obtain the dynamic map corresponding to the target rendering option.
13. An electronic device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements a model rendering method for dynamic effects as described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the model rendering method with dynamic effects as described in any one of claims 1-11.
Citation Information
Patent Citations
Dynamic light special effect display method and device, computer equipment and storage medium
CN115131493A