Method and device for generating diffusion effect, electronic equipment and storage medium

CN117726504BActive Publication Date: 2026-10-09NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311790249.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-22
Publication Date
2026-10-09
Estimated Expiration
2043-12-22

AI Technical Summary

Technical Problem

[0005]然而,上述方案在应对较大的场景时,由于圆形贴图需要放大以适应该较大的场景,对圆形贴图的精度的要求过于高,因此,上述方案通常无法满足较大场景的需求

Benefits of technology

[0017]As can be seen from the above description, the diffusion effect generation method, apparatus, electronic device, and storage medium provided in this disclosure include: determining a texture coordinate system; for all texture horizontal coordinates in the texture coordinate system, determining a first difference obtained by subtracting the texture horizontal coordinate from a preset value, and determining the maximum value among the first difference and the texture horizontal coordinate to obtain a first maximum value; for all texture vertical coordinates in the texture coordinate system, determining a second difference obtained by subtracting the texture vertical coordinate from the preset value, and determining the maximum value among the second difference and the texture vertical coordinate to obtain a second maximum value; adding all the first maximum values ​​and all the second maximum values ​​to obtain an intermediate parameter; processing the intermediate parameter based on a specified function to obtain a diffusion effect model; and mapping the diffusion effect model to a specified area to obtain a diffusion effect. In this disclosure, the diffusion effect model is obtained based on the infinite gradual transformation of texture coordinates in the texture coordinate system. The diffusion effect achieved based on this diffusion effect model is not limited by the scene size and can exhibit high accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117726504B_ABST
    Figure CN117726504B_ABST
Patent Text Reader

Abstract

The present disclosure provides a diffusion effect generation method and device, electronic equipment and storage medium, comprising: determining a texture coordinate system; for all texture horizontal coordinates in the texture coordinate system, subtracting the texture horizontal coordinates from a preset value to obtain a first difference value, determining the maximum value of the first difference value and the texture horizontal coordinates to obtain a first maximum value; for all texture vertical coordinates in the texture coordinate system, subtracting the texture vertical coordinates from a preset value to obtain a second difference value, determining the maximum value of the second difference value and the texture vertical coordinates to obtain a second maximum value; adding all first maximum values and all second maximum values to obtain an intermediate parameter; processing the intermediate parameter based on a specified function to obtain a diffusion effect model; and mapping the diffusion effect model to a specified area to obtain a diffusion effect. The present disclosure obtains a diffusion effect model based on the infinite gradual transformation of the texture coordinates in the texture coordinate system, and the diffusion effect realized based on the diffusion effect model is not limited by the size of the scene and has high precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer graphics technology, and more particularly to a method, apparatus, electronic device, and storage medium for generating diffusion effects. Background Technology

[0002] This section is intended to provide background or context for the embodiments of this disclosure as set forth in the claims. The description herein is not intended to be a prior art simply because it is included in this section.

[0003] In video games, there are some diffusion effects, such as vortexes, ripples, quicksand, etc.

[0004] In related technologies, the following approach is typically used to generate a diffusion effect: hollow out the circular texture input by the user, import the sampling results of the circular texture into a trigonometric function to make the sampling results produce peaks and troughs, and repeat this process continuously through UV flow to produce a diffusion effect in concentric circles.

[0005] However, when dealing with larger scenes, the above solutions often fail to meet the needs of larger scenes because the circular textures need to be enlarged to fit the larger scene, which places excessively high demands on the precision of the circular textures. Summary of the Invention

[0006] In view of this, the purpose of this disclosure is to provide a method, apparatus, electronic device and storage medium for generating diffusion effects, which at least partially solves one of the technical problems in the related art.

[0007] To achieve the above objectives, the first aspect of this exemplary embodiment provides a method for generating a diffusion effect, comprising:

[0008] Determine the texture coordinate system;

[0009] For all texture horizontal coordinates in the texture coordinate system, a first difference is obtained by subtracting the texture horizontal coordinate from a preset value. The maximum value between the first difference and the texture horizontal coordinate is then determined to obtain a first maximum value. For all texture vertical coordinates in the texture coordinate system, a second difference is obtained by subtracting the texture vertical coordinate from the preset value. The maximum value between the second difference and the texture vertical coordinate is then determined to obtain a second maximum value. All the first maximum values ​​and all the second maximum values ​​are added together to obtain an intermediate parameter. The intermediate parameter is then processed based on a specified function to obtain a diffusion effect model.

[0010] The diffusion effect model is mapped to a specified area to obtain the diffusion effect.

[0011] Based on the same inventive concept, a second aspect of the exemplary embodiments of this disclosure provides an apparatus for generating a diffusion effect, comprising:

[0012] The texture coordinate system determination module is configured to determine the texture coordinate system;

[0013] The diffusion effect model generation module is configured to: for all texture horizontal coordinates in the texture coordinate system, determine a first difference obtained by subtracting the texture horizontal coordinate from a preset value; determine the maximum value between the first difference and the texture horizontal coordinate to obtain a first maximum value; for all texture vertical coordinates in the texture coordinate system, determine a second difference obtained by subtracting the texture vertical coordinate from the preset value; determine the maximum value between the second difference and the texture vertical coordinate to obtain a second maximum value; add all the first maximum values ​​and all the second maximum values ​​to obtain intermediate parameters; and process the intermediate parameters based on a specified function to obtain the diffusion effect model.

[0014] The diffusion effect generation module is configured to map the diffusion effect model to a specified area to obtain a diffusion effect.

[0015] Based on the same inventive concept, a third aspect of the exemplary embodiments of this disclosure provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method as described in the first aspect.

[0016] Based on the same inventive concept, a fourth aspect of the exemplary embodiments of this disclosure provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method as described in the first aspect.

[0017] As can be seen from the above description, the diffusion effect generation method, apparatus, electronic device, and storage medium provided in this disclosure include: determining a texture coordinate system; for all texture horizontal coordinates in the texture coordinate system, determining a first difference obtained by subtracting the texture horizontal coordinate from a preset value, and determining the maximum value among the first difference and the texture horizontal coordinate to obtain a first maximum value; for all texture vertical coordinates in the texture coordinate system, determining a second difference obtained by subtracting the texture vertical coordinate from the preset value, and determining the maximum value among the second difference and the texture vertical coordinate to obtain a second maximum value; adding all the first maximum values ​​and all the second maximum values ​​to obtain an intermediate parameter; processing the intermediate parameter based on a specified function to obtain a diffusion effect model; and mapping the diffusion effect model to a specified area to obtain a diffusion effect. In this disclosure, the diffusion effect model is obtained based on the infinite gradual transformation of texture coordinates in the texture coordinate system. The diffusion effect achieved based on this diffusion effect model is not limited by the scene size and can exhibit high accuracy. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in this disclosure or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1A This is a schematic diagram of a circular texture in related technologies;

[0020] Figure 1B This is a schematic diagram of a hollow circular texture in related technologies;

[0021] Figure 1C This is a schematic diagram of the diffusion effect in related technologies;

[0022] Figure 2 A schematic diagram illustrating an application scenario of the diffusion effect generation method provided as an exemplary embodiment of this disclosure;

[0023] Figure 3 A schematic flowchart of a method for generating diffusion effects provided as an exemplary embodiment of this disclosure;

[0024] Figure 4 A schematic diagram of a texture coordinate system provided for an exemplary embodiment of this disclosure;

[0025] Figure 5 A schematic diagram of a concentric circle-shaped diffusion effect model provided for an exemplary embodiment of this disclosure;

[0026] Figure 6 A schematic diagram of a cross-shaped diffusion effect model provided for an exemplary embodiment of this disclosure;

[0027] Figure 7 A schematic diagram illustrating another application scenario of the diffusion effect generation method provided as an exemplary embodiment of this disclosure;

[0028] Figure 8 A schematic diagram of a diffusion effect model provided for an exemplary embodiment of this disclosure;

[0029] Figure 9 Another schematic diagram of a diffusion effect model provided for an exemplary embodiment of this disclosure;

[0030] Figure 10 Another schematic diagram of a diffusion effect model provided for an exemplary embodiment of this disclosure;

[0031] Figure 11 Another schematic diagram of a diffusion effect model provided for an exemplary embodiment of this disclosure;

[0032] Figure 12 Another schematic diagram of a diffusion effect model provided for an exemplary embodiment of this disclosure;

[0033] Figure 13 Another schematic diagram of a diffusion effect model provided for an exemplary embodiment of this disclosure;

[0034] Figure 14 Another schematic diagram of a diffusion effect model provided for an exemplary embodiment of this disclosure;

[0035] Figure 15 Another schematic diagram of a diffusion effect model provided for an exemplary embodiment of this disclosure;

[0036] Figure 16A A schematic diagram of a normalized dot matrix of a screen provided for an exemplary embodiment of this disclosure;

[0037] Figure 16B Another schematic diagram of a normalized dot matrix of a screen provided for an exemplary embodiment of this disclosure;

[0038] Figure 17 Another schematic diagram of a diffusion effect model provided for an exemplary embodiment of this disclosure;

[0039] Figure 18A A schematic diagram illustrating the diffusion effect provided for an exemplary embodiment of this disclosure;

[0040] Figure 18B Another schematic diagram illustrating the diffusion effect provided for an exemplary embodiment of this disclosure;

[0041] Figure 19 A schematic diagram of a diffusion effect generation apparatus provided for an exemplary embodiment of this disclosure;

[0042] Figure 20 A schematic diagram of the structure of an electronic device provided as an exemplary embodiment of the present disclosure. Detailed Implementation

[0043] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0044] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this application's technical solution, based on the prompt message.

[0045] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0046] It is understood that the above notification and user authorization process is merely illustrative and does not limit the implementation of this application. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this application.

[0047] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0048] To make the objectives, technical solutions, and advantages of this disclosure clearer, the principles and spirit of this disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided merely to enable those skilled in the art to better understand and implement this disclosure, and are not intended to limit the scope of this disclosure in any way. Rather, these embodiments are provided to make this disclosure more thorough and complete, and to fully convey the scope of this disclosure to those skilled in the art.

[0049] In this article, it is important to understand that any number of elements in the accompanying figures is for illustrative purposes and not for limitation, and any naming is for distinction only and has no limiting meaning.

[0050] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this disclosure should have the ordinary meaning understood by one of ordinary skill in the art to which this disclosure pertains. The terms "first," "second," and similar words used in the embodiments of this disclosure do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly. The article "a" or "an" preceding an element does not exclude the existence of multiple such elements.

[0051] The principles and spirit of this disclosure will be explained in detail below with reference to several representative embodiments.

[0052] As described in the background section, there are some diffusion effects in video games, such as vortexes, ripples, quicksand, etc.

[0053] In related technologies, the following methods are typically used to generate a diffusion effect:

[0054] Receive a circular sticker input by the user, for reference. Figure 1A ;

[0055] The user-input circular texture is hollowed out to obtain a hollowed-out circular texture. (Refer to...) Figure 1B ;

[0056] The hollowed-out circular texture is sampled to obtain the sampling result. This result is then imported into a trigonometric function to create peaks and troughs. This process is repeated continuously using UV flow to produce a concentric diffusion effect. (Refer to...) Figure 1C .

[0057] However, the inventors of this disclosure have found that when dealing with larger scenes, the above-mentioned solutions require excessively high precision of the circular textures because the circular textures need to be enlarged to fit the larger scene. For example, if the effect of the flowing sand river is to be achieved, a circular texture with a precision of 8k cannot meet the requirements. Therefore, the above-mentioned solutions usually cannot meet the needs of larger scenes.

[0058] To address the aforementioned issues, this disclosure provides a diffusion effect generation scheme, specifically including: determining a texture coordinate system; for all texture horizontal coordinates in the texture coordinate system, determining a first difference obtained by subtracting the texture horizontal coordinate from a preset value, and determining the maximum value among the first difference and the texture horizontal coordinate to obtain a first maximum value; for all texture vertical coordinates in the texture coordinate system, determining a second difference obtained by subtracting the texture vertical coordinate from the preset value, and determining the maximum value among the second difference and the texture vertical coordinate to obtain a second maximum value; adding all the first maximum values ​​and all the second maximum values ​​to obtain an intermediate parameter; processing the intermediate parameter based on a specified function to obtain a diffusion effect model; and mapping the diffusion effect model to a specified region to obtain a diffusion effect. In this disclosure, the diffusion effect model is obtained based on the infinite gradual transformation of texture coordinates in the texture coordinate system. The diffusion effect achieved based on this diffusion effect model is not limited by the scene size and can exhibit high accuracy.

[0059] After introducing the basic principles of this disclosure, various non-limiting embodiments of this disclosure will be described in detail below.

[0060] refer to Figure 2 This is a schematic diagram illustrating an application scenario of the diffusion effect generation method provided by an exemplary embodiment of this disclosure.

[0061] This application scenario includes a terminal device 110 and a server 120. The terminal device 110 and the server 120 can be connected via a wired or wireless communication network to achieve data interaction.

[0062] Terminal device 110 may be an electronic device located close to the user side, possessing data transmission and multimedia input / output functions, including but not limited to desktop computers, mobile phones, portable computers, tablet computers, media players, smart wearable devices, personal digital assistants (PDAs), or other electronic devices capable of performing the aforementioned functions. This electronic device may include a processor and a display screen with touch input functionality. The display screen is used to present a graphical user interface (GUI), which can display an application interface. The processor is used to process application data, generate the GUI, and control the display of the GUI on the screen.

[0063] Server 120 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0064] In some exemplary embodiments, the method for generating the diffusion effect can be run on terminal device 110 or server 120.

[0065] When the diffusion effect generation method runs on server 120, server 120 provides diffusion effect generation services to users of terminal device 110. Terminal device 110 has a client installed that communicates with server 120. Users can input diffusion effect generation commands through this client, which sends the commands to server 120. Server 120 determines a texture coordinate system; for all texture horizontal coordinates in the texture coordinate system, it determines a first difference obtained by subtracting a preset value from the texture horizontal coordinate, and determines the maximum value between the first difference and the texture horizontal coordinate to obtain a first maximum value; for all texture vertical coordinates in the texture coordinate system, it determines a second difference obtained by subtracting the preset value from the texture vertical coordinate, and determines the maximum value between the second difference and the texture vertical coordinate to obtain a second maximum value; it adds all the first maximum values ​​and all the second maximum values ​​to obtain intermediate parameters; it processes the intermediate parameters based on a specified function to obtain a diffusion effect model; and it maps the diffusion effect model to a specified area to obtain the diffusion effect. Server 120 can also send the diffusion effect to the client, which then displays the diffusion effect to the user.

[0066] When the method for generating the diffusion effect runs on server 120, the method can be implemented and executed based on the cloud interactive system.

[0067] The cloud interaction system includes client devices and cloud gaming servers.

[0068] In some exemplary embodiments, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operation mode, the main body running the game program and the main body displaying the game screen are separated. The storage and operation of the control methods for movement in the game are completed on the cloud gaming server. The role of the client device is to receive and send data and display the game screen. For example, the client device can be a display device with data transmission capabilities close to the user, such as a mobile terminal, television, computer, or PDA; however, the information processing is performed by the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the client device through the network, and finally, the client device decodes and outputs the game screen.

[0069] In the above embodiments, the method for generating the diffusion effect is described using server 120 as an example. However, this disclosure is not limited thereto. In some exemplary embodiments, the method for generating the diffusion effect can also be run on terminal device 110.

[0070] When the diffusion effect generation method runs on terminal device 110, terminal device 110 may include a display screen and a processor. A client is installed on terminal device 110, allowing users to input diffusion effect generation commands. The client sends these commands to the processor, which determines a texture coordinate system. For all texture horizontal coordinates in the texture coordinate system, a first difference is obtained by subtracting a preset value from the texture horizontal coordinate. The maximum value between the first difference and the texture horizontal coordinate is then determined to obtain a first maximum value. For all texture vertical coordinates in the texture coordinate system, a second difference is obtained by subtracting the preset value from the texture vertical coordinate. The maximum value between the second difference and the texture vertical coordinate is then determined to obtain a second maximum value. All the first maximum values ​​and all the second maximum values ​​are added together to obtain intermediate parameters. The intermediate parameters are processed based on a specified function to obtain a diffusion effect model. The diffusion effect model is then mapped to a specified area to obtain the diffusion effect. The processor can also send the diffusion effect to the client, which displays the diffusion effect to the user through the display screen.

[0071] When the diffusion effect generation method is run on terminal device 110, taking a game as an example, the terminal device stores a game program and is used to display the game screen. The terminal device is used to interact with the player through a graphical user interface, that is, conventionally downloading, installing, and running the game program via an electronic device. The terminal device can provide the graphical user interface to the player in various ways, such as rendering it on the terminal's display screen or providing it to the player through holographic projection. For example, the terminal device can include a display screen for displaying the graphical user interface, which includes the game screen, and a processor for running the game, generating the graphical user interface, and controlling the display of the graphical user interface on the display screen.

[0072] The following is combined with Figure 2 The above application scenarios are used to describe the method for generating diffusion effects according to exemplary embodiments of this disclosure. It should be noted that the above application scenarios are shown only to facilitate understanding of the spirit and principles of this disclosure, and the embodiments of this disclosure are not limited in any way. Rather, the embodiments of this disclosure can be applied to any applicable scenario.

[0073] refer to Figure 3 This is a flowchart illustrating a method for generating diffusion effects provided by an exemplary embodiment of the present disclosure.

[0074] The method for generating a diffusion effect includes the following steps:

[0075] Step S310: Determine the texture coordinate system.

[0076] The texture coordinates in the texture coordinate system, including the texture horizontal coordinate and the texture vertical coordinate, gradually change infinitely between zero and a preset value.

[0077] refer to Figure 4 We will first introduce the texture coordinate system:

[0078] The texture coordinate system used in the exemplary embodiments of this disclosure includes a 2D texture coordinate system. In this 2D texture coordinate system, the 2D texture coordinates range from 0 to 1 on the x-axis and y-axis. The texture coordinates start at (0,0), which is the lower left corner of the 2D texture coordinate system, and end at (1,1), which is the upper right corner of the 2D texture coordinate system. When the texture coordinates in the texture coordinate system range from 0 to 1 on the x-axis and y-axis, the preset value is 1. For ease of description, the preset value of 1 will be used as an example in the following exemplary embodiments.

[0079] In the exemplary embodiments described above, the texture coordinate system was introduced. Below, we will continue to describe how to perform specified operations based on the texture coordinate system to obtain the diffusion effect model:

[0080] Step S320: For all texture horizontal coordinates in the texture coordinate system, determine a first difference obtained by subtracting the texture horizontal coordinate from a preset value, and determine the maximum value among the first difference and the texture horizontal coordinate to obtain a first maximum value; For all texture vertical coordinates in the texture coordinate system, determine a second difference obtained by subtracting the texture vertical coordinate from the preset value, and determine the maximum value among the second difference and the texture vertical coordinate to obtain a second maximum value; Add all the first maximum values ​​and all the second maximum values ​​to obtain intermediate parameters; Process the intermediate parameters based on a specified function to obtain a diffusion effect model.

[0081] As described above, when the texture coordinates in the texture coordinate system are between 0 and 1 on the x-axis and y-axis, the preset value is 1. For ease of explanation, the following exemplary embodiment will use a preset value of 1 as an example.

[0082] In practical implementation, during the intermediate parameter stage, a circular model is obtained, and its formula includes:

[0083] Round=Max(X,1-X)+Max(Y,1-Y);

[0084] Where Round represents the circular model in the intermediate parameter stage, Max represents the maximum value function, X represents the texture horizontal coordinate, Y represents the texture vertical coordinate, and 1 is the preset value.

[0085] The formula for the diffusion effect model includes:

[0086] Diffusion=f(Max(X,1-X)+Max(Y,1-Y));

[0087] Where Diffusion represents the diffusion effect model, f represents the specified function, Max represents the maximum value function, X represents the texture horizontal coordinate, Y represents the texture vertical coordinate, and 1 is the preset value.

[0088] In this exemplary embodiment, different diffusion effect models with different shapes can be obtained by using different specified functions, thereby achieving diffusion effects with different shapes. The specified functions include at least one of the following:

[0089] Trigonometric functions (including sine functions, etc.) and minimum value functions.

[0090] refer to Figure 5 We will first introduce the diffusion effect model of concentric circles when the specified function is a sine function.

[0091] In practice, when the specified function is the sine function Sin, the diffusion effect model is a concentric circle-shaped diffusion effect model.

[0092] The formula for the concentric circle diffusion effect model includes:

[0093] Concentric circles diffusion=Sin(Max(X,1-X)+Max(Y,1-Y));

[0094] Wherein, Concentric circles diffusion represents a diffusion effect model in the shape of concentric circles, Sin represents the sine function, Max represents the maximum value function, X represents the texture horizontal coordinate, Y represents the texture vertical coordinate, and 1 is the preset value.

[0095] Specifically, when the diffusion effect model is a concentric circle shape, the diffusion effect model is mapped to a specified area, and the resulting diffusion effect is a concentric circle shape.

[0096] refer to Figure 6 We will continue to introduce the cross-shaped diffusion effect model obtained when the specified function is the minimum value function.

[0097] In practice, when the specified function is the minimum function Min, the diffusion effect model is a cross-shaped diffusion effect model.

[0098] The formula for the cross-shaped diffusion effect model includes:

[0099] Cross diffusion=Min(Max(X,1-X)+Max(Y,1-Y));

[0100] Wherein, Cross diffusion represents a cross-shaped diffusion effect model, Min represents the minimum value function, Max represents the maximum value function, X represents the texture horizontal coordinate, Y represents the texture vertical coordinate, and 1 is the preset value.

[0101] Specifically, when the diffusion effect model is a cross-shaped diffusion effect model, the diffusion effect model is mapped to the specified area, and the resulting diffusion effect is a cross-shaped diffusion effect.

[0102] It should be noted that the principle of this disclosure lies in using the infinite gradient transformation of texture coordinates between 0 and a preset value, such as 1, to obtain a diffusion effect model. Although in the exemplary embodiment, it is as follows... Figure 5 The concentric circle diffusion effect model shown and as Figure 6 The cross-shaped diffusion effect model shown is used as an example for illustration. However, this disclosure does not limit the specific shape of the diffusion effect model. The calculation method can be adjusted according to actual needs to obtain diffusion effect models of different shapes, thereby mapping diffusion effects of different shapes.

[0103] In the above exemplary embodiments, a method for obtaining a diffusion effect model by performing specified operations based on a texture coordinate system was described. However, this disclosure is not limited to this. In the process of obtaining a diffusion effect model by performing specified operations based on a texture coordinate system, some parameters can be introduced to control the size of the obtained diffusion effect model, which will be described in detail below:

[0104] In this exemplary embodiment, the step of adding all the first maximum values ​​and all the second maximum values ​​to obtain intermediate parameters includes:

[0105] The intermediate parameter is obtained by subtracting the first parameter from the first maximum value and the second maximum value respectively, multiplying them by the second parameter, raising the result to a specified power, and then adding them together.

[0106] Wherein, the first parameter is a constant less than the preset value.

[0107] The first parameter is configured to expand the size of the diffusion effect model. Since neither the first nor the second maximum value will exceed a preset value, the expansion of the diffusion effect model can be controlled by subtracting any constant smaller than the preset value.

[0108] The second parameter is configured to adjust the degree of realism or abstraction of the diffusion effect model, such as a solid circle or a halo.

[0109] The specified power is configured to expand the size of the diffusion effect model. Since neither the first nor the second maximum value will exceed a preset value, the expansion of the diffusion effect model can be controlled by raising it to a specified power.

[0110] In this exemplary embodiment, when the size of the obtained diffusion effect model is controlled by introducing the above parameters, the formula for the diffusion effect model includes:

[0111] Diffusion=f([S*(Max(X,1-X)-Q)] P +[S*(Max(Y,1-Y)-Q)] P );

[0112] Where Diffusion represents the diffusion effect model, f represents the specified function, Max represents the maximum value function, X represents the texture horizontal coordinate, Y represents the texture vertical coordinate, Q represents the first parameter, S represents the second parameter, P represents the specified power, and 1 is the preset value.

[0113] In practice, the first parameter, the second parameter, and the specified power can be set according to actual needs (the first parameter is limited to a constant less than a preset value). As a specific example, taking the first parameter as 0.5, the second parameter as 2, and the specified power as 2, the formula for the diffusion effect model is as follows:

[0114] Diffusion=f([2*(Max(X,1-X)-0.5)] 2 +[2*(Max(Y,1-Y)-0.5)] 2 ).

[0115] The specified function f includes at least one of the following:

[0116] Sine function Sin, minimum value function Min.

[0117] In this exemplary embodiment, the step of processing the intermediate parameters based on a specified function to obtain the diffusion effect model includes:

[0118] The intermediate parameters are normalized to obtain normalized intermediate parameters;

[0119] The diffusion effect model is obtained by processing the normalized intermediate parameters based on a specified function.

[0120] In practice, the intermediate parameters are normalized to obtain normalized intermediate parameters RG (the texture horizontal coordinate is stored in the R channel of the RGB channel, and the texture vertical coordinate is stored in the G channel of the RGB channel); the normalized intermediate parameters RG are then substituted into a specified function, such as the sine function (Sin), to obtain the diffusion effect model as Sin(RG).

[0121] In the above exemplary embodiments, a method for obtaining a diffusion effect model by performing specified operations based on the texture coordinate system was introduced. Below, refer to... Figure 7 The following explanation will use the generation method of the diffusion effect model described above in Unreal Engine (UE) as an example:

[0122] The texture coordinate system is provided through texture coordinate nodes.

[0123] In Unreal Engine, texture coordinate nodes are used to generate or pass texture coordinates in the Material Editor. Texture coordinates determine how textures are mapped onto the model's surface. Texture coordinate nodes can be used to control texture repetition, rotation, translation, and the creation of material effects.

[0124] The texture coordinate node constructs a texture coordinate system based on the color vector, storing the texture horizontal coordinate in the R channel of the RGB channel and the texture vertical coordinate in the G channel of the RGB channel.

[0125] RGB channels: The RGB color mode is an industry color standard that uses variations in the three color channels (red, G, and blue) and their superposition to obtain a wide variety of colors. RGB represents the colors of the red, green, and blue channels. This standard covers almost all colors that can be perceived by human vision and is one of the most widely used color systems.

[0126] Alternatively, the texture horizontal coordinate can be stored in the G channel and the texture vertical coordinate in the R channel, which will not be elaborated further here.

[0127] refer to Figure 7 Among them, texture coordinate system 701 is a 2D texture coordinate system. In this 2D texture coordinate system, the 2D texture coordinates are on the x-axis and y-axis, and the range is between 0 and 1. The texture coordinates start at (0,0), which is the upper left corner of the 2D texture coordinate system, and end at (1,1), which is the lower right corner of the 2D texture coordinate system. The default value is 1.

[0128] For all texture horizontal coordinates in the texture coordinate system 701, determine the first difference obtained by subtracting the texture horizontal coordinate from the preset value, and determine the first difference and the maximum value in the texture horizontal coordinate to obtain the first maximum value 702.

[0129] For all texture ordinates in the texture coordinate system 701, determine the second difference obtained by subtracting the texture ordinate from the preset value, and determine the maximum value of the second difference and the texture ordinate to obtain the second maximum value 703;

[0130] Subtracting the first parameter from the first maximum value 702 and then multiplying it by the second parameter yields the first maximum value 704 after processing by the first and second parameters.

[0131] Subtracting the first parameter from the second maximum value 703 and then multiplying it by the second parameter, we obtain the second maximum value 705 after processing by the first and second parameters.

[0132] The first maximum value 704 after processing with the first and second parameters is raised to a specified power to obtain the first maximum value 706 after processing with a specified power.

[0133] After processing the second maximum value 705 with the first and second parameters, raise it to a specified power to obtain the second maximum value 707 after being processed by the specified power.

[0134] Add the first maximum value 706 (after being processed by a specified power) and the second maximum value 707 (after being processed by a specified power) to obtain the intermediate parameter 708.

[0135] Step S330: Map the diffusion effect model to a specified area to obtain the diffusion effect.

[0136] In this exemplary embodiment, mapping the diffusion effect model to a specified region to obtain the diffusion effect includes:

[0137] Based on the decal, the diffusion effect model is mapped onto the specified area to obtain the diffusion effect.

[0138] Among them, decals refer to applying two-dimensional images to the surface of a three-dimensional model.

[0139] In practice, decal textures are used in the material, and the textures are blended with the model surface based on the normals and UV coordinates. By adjusting the material parameters, the position, size, and transparency of the decals can be controlled to achieve different effects.

[0140] refer to Figure 8 The diffusion effect model obtained based on this disclosure will increase in size as the number of quadrants contained in the texture coordinates increases. The diffusion effect model will extend, rather than enlarging the diffusion effect map by a certain ratio as in related technologies. Therefore, the accuracy will not be affected.

[0141] However, in the above exemplary embodiments, since the diffusion effect model increases with the number of quadrants contained in the texture coordinates, the diffusion effect model will extend and multiple diffusion effect models cannot be obtained. In order to obtain multiple diffusion effect models, that is, to achieve the effect that the number of diffusion effect models increases with the number of quadrants contained in the texture coordinates, this disclosure provides the following method:

[0142] In this exemplary embodiment, after determining the texture coordinate system and performing specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes:

[0143] Based on the frac function, the diffusion effect model is truncated to obtain several diffusion effect models distributed in several quadrants.

[0144] The number of the several diffusion effect parameters obtained is controlled based on the third parameter in the frac function, and the third parameter is a constant greater than the preset value.

[0145] The formula for the frac function includes:

[0146] frac(B*texcord);

[0147] Where frac represents the frac function; B represents the third parameter, which is a constant greater than the preset value, indicating that it is expected to divide the diffusion effect model into B*B quadrants and generate a diffusion effect model in each quadrant, that is, it is expected to generate B*B diffusion effect models; texcord represents the diffusion effect model represented by texture coordinates.

[0148] refer to Figure 9 This demonstrates 4x4 diffusion effect models generated through the exemplary embodiments described above.

[0149] In the above exemplary embodiments, several diffusion effect models distributed in several quadrants were obtained. However, all of these diffusion effect models are identical, and it is impossible to process each diffusion effect model individually. This disclosure solves this problem through the following exemplary embodiments:

[0150] In some exemplary embodiments, after truncating the diffusion effect model based on the frac function to obtain several diffusion effect models distributed in several quadrants, the method further includes:

[0151] By multiplying the diffusion effect models in different quadrants with different three-dimensional vectors, diffusion effect models of different shapes are obtained.

[0152] In practice:

[0153] To further randomize the distinction between each quadrant, a random value needs to be generated for each quadrant to shuffle its performance. This random value only needs to be sufficient to shuffle the results of each adjacent quadrant. The formula includes:

[0154] Radius=frac((UV.xyx)*scale);

[0155] To allow the radius to be multiplied by the texcoordinate (UV), which is a 2D vector, we use uv.xyx. However, using UV.xyy would also work, but it would require constructing a 3D vector. frac ensures that the results for each quadrant are separate.

[0156] Radius+=dot(Radius,Radius.yzx+10);

[0157] return frac((Radius.x+Radius.y)*Radius.z);

[0158] The principle is to shuffle the values ​​within the quadrant by multiplying by the three-dimensional vector of scale. As long as the xyz values ​​of scale are guaranteed, the numerical aspects are mainly based on the final result meeting the actual needs, without any restrictions. As long as they are all different and the numerical difference is not too large, a sufficiently random result can be created.

[0159] This value can then be substituted into any quadrant. Each quadrant has a corresponding grayscale value, so for example, you can multiply the value of each quadrant back into `texcoordinate`, thus obtaining a different number for each quadrant. See the example for the implementation. Figure 10 The shapes of the diffusion effect models differ in different quadrants.

[0160] In the above exemplary embodiments, a diffusion effect model with concentric circles of diffusion or contraction can be obtained. However, if there are only concentric circles of diffusion or contraction, the displayed effect is too regular. In order to further enhance the flow effect of the diffusion effect realized based on the diffusion effect model, this disclosure provides the following method:

[0161] In this exemplary embodiment, after determining the texture coordinate system and performing specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes:

[0162] The diffusion effect model is distorted based on a preset manifold diagram to obtain a diffusion effect model with a distorted effect.

[0163] In this exemplary embodiment, the step of distorting the diffusion effect model based on the manifold diagram to obtain a diffusion effect model with a distorted effect includes:

[0164] The manifold is superimposed on the texture coordinate system to obtain a distorted texture coordinate system;

[0165] The specified operation is performed based on the distorted texture coordinate system to obtain the diffusion effect model with the distorted effect.

[0166] In this exemplary embodiment, the step of superimposing the manifold map with the texture coordinate system to obtain a distorted texture coordinate system includes:

[0167] The manifold graph is multiplied by the fourth parameter and then superimposed on the texture coordinate system to obtain the distorted texture coordinate system;

[0168] The fourth parameter is configured to control the degree of distortion of the distorted texture coordinate system.

[0169] In this exemplary embodiment, after performing specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes:

[0170] Determine the pixel position and center position of the diffusion effect model;

[0171] Based on the pixel position and the center position, a masking model is obtained;

[0172] Based on the masking model, the central region of the diffusion effect model is controlled.

[0173] In practice:

[0174] Taking the simulated diffusion effect of quicksand as an example, to achieve a more realistic quicksand effect, simply diffusing or contracting in concentric circles is clearly insufficient, as it would appear too regular. Therefore, a flowmap-based distortion diffusion effect model (Texturecoordinate) is used to shape some flowing shapes. (Since this disclosure is based on the diffusion effect model obtained from texture coordinates, the term Texturecoordinate is usually used to refer to the diffusion effect model at each stage.)

[0175] The creation method and principle of flowmap can actually be traced back to texture coordinate, because the reason why texture coordinate itself presents red and green superimposed colors is because the 0-1 gradients of red and green are superimposed at the same time.

[0176] This basic coordinate diagram represents the positions of the final model pixels and UV coordinates. However, if we increase a number at one point in this coordinate system and decrease another, for example, moving a point originally at (0.5, 0.5) to (0.6, 0.6), and if we make some changes to all the coordinate positions, the entire diffusion effect model obtained above will be distorted and altered. (See reference for details.) Figure 11 .

[0177] However, Figure 11 The result looked a bit too exaggerated, so some nodes were added to control the magnitude of the force.

[0178] The diffusion process is exactly the same as described above. Before calculating the texturecoordinate, the flowmap result is added to the coordinate, and then a constant is multiplied by the flowmap to control its strength. For greater realism, a panel node is added to make the flowmap more random and dynamic, ultimately reducing the flowmap result by a factor of 5. (See the results for reference.) Figure 12 .

[0179] To make the results more random, the entire calculation process was recalculated by changing the UV size. Then, the maximum values ​​of the two results were summed to achieve a more random appearance. (See results for reference.) Figure 13 .

[0180] To allow for free control over whether the center point has sand or not, an additional control function is needed. However, the traditional method of using a single texture as a mask to control the center point's color cannot be used here (because the model is very large, and texture accuracy will be incorrect in large models). Therefore, a world space masking method is used to create it.

[0181] Using the position of model pixels and the information of the model's center position, a circle radiating from the center point is obtained. The closer to the center, the closer the value is to 0. The result is denoted as R. Then, R is multiplied by the previous result to obtain the control over the central part. The result is referenced... Figure 14 .

[0182] To add a certain degree of granularity to the diffusion effect implemented based on the diffusion effect model, this disclosure provides the following method:

[0183] In this exemplary embodiment, after determining the texture coordinate system and performing specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes:

[0184] Identify the noisy image;

[0185] The coordinates of the noise image are obtained based on the pixel positions on the screen;

[0186] Based on the coordinates of the noise image, the noise image is superimposed on the diffusion effect model to obtain a diffusion effect model with a particle effect.

[0187] In practice:

[0188] Taking the diffusion effect of simulated quicksand as an example, to make the overall effect look more like sand, some graininess needs to be added. However, as mentioned above, the diffusion effect model provided in this disclosure does not rely on textures. Furthermore, texture coordinates themselves do not have the function of directly creating particles. To solve this problem, this disclosure uses a technique of mapping the particle effect onto screen space. Because the screen size does not change, regardless of the size of the model on the screen, the screen's UV coordinates will not change. This characteristic can be used to overlay a noise map to produce a sand-like feel. Specifically:

[0189] First, obtain a noisy image as source material; the noise just needs to be random enough.

[0190] Then, the screen pixels are used as the UV of the noise map.

[0191] Then, the previous results are added to the preceding noise map, that is, the noise is incorporated into the original diffusion result. The resulting display effect is shown in the reference image. Figure 15 .

[0192] The above exemplary embodiments can basically achieve a particle effect unaffected by model size, but upon closer inspection, the repetition is still too noticeable (because the image must be tiled many times to ensure quality). Therefore, to eliminate the repetitive feeling, it is necessary to directly obtain the screen pixels and perform normalization:

[0193] In this exemplary embodiment, obtaining the coordinates of the noise image based on the pixel position of the screen includes:

[0194] Determine the screen pixels;

[0195] The coordinates of the noisy image are obtained by processing the screen pixels using the modulo function.

[0196] In practice:

[0197] Obtain the pixel position on the screen, treat it as the variable Pixel, and then perform the following calculations:

[0198] Mod(((uint)(Pixel.x)+2*(uint)(Pixel.y)),D)

[0199] The principle behind these steps is as follows: First, obtain all the pixels in the screen through the screen position node. Then, take a portion of them and divide it by a constant, where pixel is the screen pixel result obtained earlier, and D is a constant used to determine the size of the remainder. This way, a screen-based normalized pixel matrix can be obtained, which is used to remove some of the repetition caused by simply using texture overlay.

[0200] In the above formula, the size of D determines the size of the remainder, which is the density of the black dot matrix. (Refer to...) Figure 16A This demonstrates the effect when D is 15; Reference Figure 16B This demonstrates the effect when D is 35.

[0201] Adding this result to the previous result will produce a more random "sand-like" effect. See the reference for the resulting display effect. Figure 17 .

[0202] refer to Figure 18A and Figure 18B The paper demonstrates the effect of generating a large area of ​​quicksand diffusion when the solution provided in this disclosure is implemented in an actual game scenario, specifically in a desert scenario.

[0203] In this context, a game scene is a virtual environment displayed (or provided) by an application while it is running on a terminal or server. Optionally, this virtual scene can be a simulation of the real world, a semi-simulated / semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene can be either a two-dimensional or three-dimensional virtual scene, and can include elements such as sky, land, or ocean. The land element may include environmental elements such as deserts and cities. Among them, a virtual scene is a scene in which the user controls virtual objects and completes the game logic. For example, in a sandbox 3D shooting game, a virtual scene is a 3D game world used by players to control virtual objects to fight. Instances of virtual scenes can include at least one element among mountains, plains, rivers, lakes, oceans, deserts, skies, plants, buildings, and vehicles. For example, in a 2D card game, a virtual scene is a scene used to display and release cards or display the virtual objects corresponding to cards. Instances of virtual scenes can include arenas, battlegrounds, or other "field" elements or other elements that can display the card battle status. For 2D or 3D multiplayer online tactical competitive games, a virtual scene is a 2D or 3D terrain scene used by virtual objects to fight. Instances of virtual scenes can include elements such as canyon-style mountains, lines, rivers, classrooms, desks and chairs, and podiums.

[0204] In practice, the solution provided by the exemplary embodiments of this disclosure can be applied in different game scenarios to generate different diffusion effects, such as generating quicksand diffusion effects in the desert, generating vortex diffusion effects in the ocean, and generating ripple diffusion effects on the lake surface.

[0205] It should be noted that the method of this disclosure embodiment can be executed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method of this disclosure embodiment, and the multiple devices will interact with each other to complete the method described.

[0206] It should be noted that the above description describes some embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0207] Based on the same inventive concept, corresponding to any of the above-described embodiments, this disclosure also provides a diffusion effect generation apparatus.

[0208] refer to Figure 19 The apparatus for generating a diffusion effect includes:

[0209] Texture coordinate system determination module 910 is configured to determine the texture coordinate system;

[0210] The diffusion effect model generation module 920 is configured to: for all texture horizontal coordinates in the texture coordinate system, determine a first difference obtained by subtracting the texture horizontal coordinate from a preset value; determine the maximum value between the first difference and the texture horizontal coordinate to obtain a first maximum value; for all texture vertical coordinates in the texture coordinate system, determine a second difference obtained by subtracting the texture vertical coordinate from the preset value; determine the maximum value between the second difference and the texture vertical coordinate to obtain a second maximum value; add all the first maximum values ​​and all the second maximum values ​​to obtain intermediate parameters; and process the intermediate parameters based on a specified function to obtain a diffusion effect model.

[0211] The diffusion effect generation module 930 is configured to map the diffusion effect model to a specified area to obtain a diffusion effect.

[0212] In some exemplary embodiments, the diffusion effect model generation module 920 is specifically configured as follows:

[0213] The intermediate parameter is obtained by subtracting the first parameter from the first maximum value and the second maximum value respectively, multiplying them by the second parameter, raising the result to a specified power, and then adding them together.

[0214] Wherein, the first parameter is a constant less than the preset value.

[0215] In some exemplary embodiments, the specified function includes at least one of the following:

[0216] Trigonometric functions, minimum value functions.

[0217] In some exemplary embodiments, the diffusion effect model generation module 920 is specifically configured as follows:

[0218] The intermediate parameters are normalized to obtain normalized intermediate parameters;

[0219] The diffusion effect model is obtained by processing the normalized intermediate parameters based on a specified function.

[0220] In some exemplary embodiments, the diffusion effect model generation module 920 is specifically configured as follows:

[0221] Based on the frac function, the diffusion effect model is truncated to obtain several diffusion effect models distributed in several quadrants.

[0222] The number of the several diffusion effect parameters obtained is controlled based on the third parameter in the frac function, and the third parameter is a constant greater than the preset value.

[0223] In some exemplary embodiments, the diffusion effect model generation module 920 is specifically configured as follows:

[0224] By multiplying the diffusion effect models in different quadrants with different three-dimensional vectors, diffusion effect models of different shapes are obtained.

[0225] In some exemplary embodiments, the diffusion effect model generation module 920 is specifically configured as follows:

[0226] The diffusion effect model is distorted based on a preset manifold diagram to obtain a diffusion effect model with a distorted effect.

[0227] In some exemplary embodiments, the diffusion effect model generation module 920 is specifically configured as follows:

[0228] The manifold is superimposed on the texture coordinate system to obtain a distorted texture coordinate system;

[0229] The specified operation is performed based on the distorted texture coordinate system to obtain the diffusion effect model with the distorted effect.

[0230] In some exemplary embodiments, the diffusion effect model generation module 920 is specifically configured as follows:

[0231] The manifold graph is multiplied by the fourth parameter and then superimposed on the texture coordinate system to obtain the distorted texture coordinate system;

[0232] The fourth parameter is configured to control the degree of distortion of the distorted texture coordinate system.

[0233] In some exemplary embodiments, the diffusion effect model generation module 920 is specifically configured as follows:

[0234] Determine the pixel position and center position of the diffusion effect model;

[0235] Based on the pixel position and the center position, a masking model is obtained;

[0236] Based on the masking model, the central region of the diffusion effect model is controlled.

[0237] In some exemplary embodiments, the diffusion effect model generation module 920 is specifically configured as follows:

[0238] Identify the noisy image;

[0239] The coordinates of the noise image are obtained based on the pixel positions on the screen;

[0240] Based on the coordinates of the noise image, the noise image is superimposed on the diffusion effect model to obtain a diffusion effect model with a particle effect.

[0241] In some exemplary embodiments, the diffusion effect model generation module 920 is specifically configured as follows:

[0242] Determine the pixel positions of the screen;

[0243] The coordinates of the noise image are obtained by processing the pixel positions on the screen using the modulo function.

[0244] For ease of description, the above apparatus is described in terms of its functions, divided into various modules. Of course, in implementing this disclosure, the functions of each module can be implemented in one or more software and / or hardware.

[0245] The apparatus of the above embodiments is used to implement the method for generating the corresponding diffusion effect in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0246] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for generating the diffusion effect described in any of the above embodiments.

[0247] Figure 20 This embodiment illustrates a more specific hardware structure of an electronic device, which may include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.

[0248] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0249] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.

[0250] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.

[0251] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0252] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.

[0253] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.

[0254] The electronic devices described above are used to implement the method for generating the corresponding diffusion effect in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0255] The memory 1020 stores machine-readable instructions executable by the processor 1010. When the electronic device is running, the processor 1010 communicates with the memory 1020 via the bus 1030, causing the processor 1010 to execute the following instructions during operation:

[0256] Determine the texture coordinate system;

[0257] For all texture horizontal coordinates in the texture coordinate system, a first difference is obtained by subtracting the texture horizontal coordinate from a preset value. The maximum value between the first difference and the texture horizontal coordinate is then determined to obtain a first maximum value. For all texture vertical coordinates in the texture coordinate system, a second difference is obtained by subtracting the texture vertical coordinate from the preset value. The maximum value between the second difference and the texture vertical coordinate is then determined to obtain a second maximum value. All the first maximum values ​​and all the second maximum values ​​are then added together to obtain an intermediate parameter.

[0258] The intermediate parameters are processed using a specified function to obtain a diffusion effect model;

[0259] The diffusion effect model is mapped to a specified area to obtain the diffusion effect.

[0260] In one possible implementation, the instruction executed by processor 1010, which involves adding all the first maximum values ​​and all the second maximum values ​​to obtain intermediate parameters, includes:

[0261] The intermediate parameter is obtained by subtracting the first parameter from the first maximum value and the second maximum value respectively, multiplying them by the second parameter, raising the result to a specified power, and then adding them together.

[0262] Wherein, the first parameter is a constant less than the preset value.

[0263] In one possible implementation, the specified function in the instructions executed by the processor 1010 includes at least one of the following:

[0264] Trigonometric functions, minimum value functions.

[0265] In one possible implementation, the instructions executed by processor 1010, which involve processing the intermediate parameters based on a specified function to obtain the diffusion effect model, include:

[0266] The intermediate parameters are normalized to obtain normalized intermediate parameters;

[0267] The diffusion effect model is obtained by processing the normalized intermediate parameters based on a specified function.

[0268] In one possible implementation, after the processor 1010 executes instructions to perform specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes:

[0269] Based on the frac function, the diffusion effect model is truncated to obtain several diffusion effect models distributed in several quadrants.

[0270] The number of the several diffusion effect parameters obtained is controlled based on the third parameter in the frac function, and the third parameter is a constant greater than the preset value.

[0271] In one possible implementation, after the processor 1010 executes instructions to truncate the diffusion effect model based on the frac function to obtain several diffusion effect models distributed in several quadrants, the method further includes:

[0272] By multiplying the diffusion effect models in different quadrants with different three-dimensional vectors, diffusion effect models of different shapes are obtained.

[0273] In one possible implementation, after the processor 1010 executes instructions to perform specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes:

[0274] The diffusion effect model is distorted based on a preset manifold diagram to obtain a diffusion effect model with a distorted effect.

[0275] In one possible implementation, the instructions executed by processor 1010, which involve distorting the diffusion effect model based on the manifold diagram to obtain a diffusion effect model with a distorted effect, include:

[0276] The manifold is superimposed on the texture coordinate system to obtain a distorted texture coordinate system;

[0277] The specified operation is performed based on the distorted texture coordinate system to obtain the diffusion effect model with the distorted effect.

[0278] In one possible implementation, the instruction executed by processor 1010 to superimpose the manifold map with the texture coordinate system to obtain a distorted texture coordinate system includes:

[0279] The manifold graph is multiplied by the fourth parameter and then superimposed on the texture coordinate system to obtain the distorted texture coordinate system;

[0280] The fourth parameter is configured to control the degree of distortion of the distorted texture coordinate system.

[0281] In one possible implementation, after the processor 1010 executes instructions to perform specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes:

[0282] Determine the pixel position and center position of the diffusion effect model;

[0283] Based on the pixel position and the center position, a masking model is obtained;

[0284] Based on the masking model, the central region of the diffusion effect model is controlled.

[0285] In one possible implementation, after the processor 1010 executes instructions to perform specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes:

[0286] Identify the noisy image;

[0287] The coordinates of the noise image are obtained based on the pixel positions on the screen;

[0288] Based on the coordinates of the noise image, the noise image is superimposed on the diffusion effect model to obtain a diffusion effect model with a particle effect.

[0289] In one possible implementation, the instructions executed by processor 1010, which involve obtaining the coordinates of the noise image based on the pixel positions on the screen, include:

[0290] Determine the pixel positions of the screen;

[0291] The coordinates of the noise image are obtained by processing the pixel positions on the screen using the modulo function.

[0292] In this disclosure, a diffusion effect model is obtained based on the infinite gradient transformation of texture coordinates. Therefore, the diffusion effect implemented based on this diffusion effect model is not limited by the scene size and can exhibit high accuracy.

[0293] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this disclosure also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the diffusion effect generation method as described in any of the above embodiments.

[0294] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0295] The aforementioned non-transitory computer-readable storage media can be any available medium or data storage device that a computer can access, including but not limited to magnetic storage (e.g., floppy disks, hard disks, magnetic tapes, magneto-optical disks (MOs), etc.), optical storage (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND flash), solid-state drives (SSDs)).

[0296] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the diffusion effect generation method as described in any of the embodiments in the exemplary method section above, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0297] Based on the same inventive concept, corresponding to the diffusion effect generation method described in any of the above embodiments, this disclosure also provides a computer program product, which includes computer program instructions. In some embodiments, the computer program instructions can be executed by one or more processors of a computer to cause the computer and / or the processor to perform the diffusion effect generation method. Corresponding to the execution entity for each step in each embodiment of the diffusion effect generation method, the processor executing the corresponding step can belong to the corresponding execution entity.

[0298] The computer program product of the above embodiments is used to cause the computer and / or the processor to execute the diffusion effect generation method as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0299] Those skilled in the art will recognize that embodiments of this disclosure can be implemented as a system, method, or computer program product. Therefore, this disclosure can be implemented as entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." Furthermore, in some embodiments, this disclosure can also be implemented as a computer program product contained in one or more computer-readable media, which includes computer-readable program code.

[0300] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example,, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (not exhaustive) of a computer-readable storage medium may include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.

[0301] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0302] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0303] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN)), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0304] It should be understood that each block of a flowchart and / or block diagram, as well as combinations of blocks in a flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine that, when executed by a computer or other programmable data processing device, creates means for implementing the functions / operations specified in the blocks of the flowchart and / or block diagram.

[0305] These computer program instructions may also be stored in a computer-readable medium that enables a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable medium produce a product comprising an instruction apparatus that implements the functions / operations specified in the boxes of a flowchart and / or block diagram.

[0306] Computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, such that the instructions that execute on the computer or other programmable apparatus can provide a process for implementing the functions / operations specified in the boxes of a flowchart and / or block diagram.

[0307] Furthermore, although the operations of the methods of this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all of the operations shown must be performed to achieve the desired result. Rather, the steps depicted in the flowcharts may be executed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0308] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

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

[0310] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this application (including the claims) is limited to these examples; within the framework of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this application as described above, which are not provided in the details for the sake of brevity.

[0311] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0312] Although this application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.

[0313] The embodiments of this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of this application.

[0314] While the spirit and principles of this disclosure have been described with reference to several specific embodiments, it should be understood that this disclosure is not limited to the disclosed specific embodiments, and the division of aspects does not imply that features in these aspects cannot be combined for benefit; such division is merely for convenience of expression. This disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims. The scope of the appended claims is to be interpreted in the broadest sense, thereby encompassing all such modifications and equivalent structures and functions.

Claims

1. A method for generating a diffusion effect, characterized in that, include: Determine the texture coordinate system; For all texture horizontal coordinates in the texture coordinate system, a first difference is obtained by subtracting the texture horizontal coordinate from a preset value. The maximum value between the first difference and the texture horizontal coordinate is then determined to obtain a first maximum value. For all texture vertical coordinates in the texture coordinate system, a second difference is obtained by subtracting the texture vertical coordinate from the preset value. The maximum value between the second difference and the texture vertical coordinate is then determined to obtain a second maximum value. All the first maximum values ​​and all the second maximum values ​​are added together to obtain an intermediate parameter. The intermediate parameter is then processed based on a specified function to obtain a diffusion effect model. The diffusion effect model is mapped to a specified area to obtain the diffusion effect.

2. The method according to claim 1, characterized in that, The step of adding all the first maximum values ​​and all the second maximum values ​​to obtain intermediate parameters includes: The intermediate parameter is obtained by subtracting the first parameter from the first maximum value and the second maximum value respectively, multiplying them by the second parameter, raising the result to a specified power, and then adding them together. Wherein, the first parameter is a constant less than the preset value.

3. The method according to claim 1, characterized in that, The specified function includes at least one of the following: Trigonometric functions, minimum value functions.

4. The method according to claim 1, characterized in that, The process of processing the intermediate parameters based on a specified function to obtain the diffusion effect model includes: The intermediate parameters are normalized to obtain normalized intermediate parameters; The diffusion effect model is obtained by processing the normalized intermediate parameters based on a specified function.

5. The method according to claim 1, characterized in that, After performing specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes: Based on the frac function, the diffusion effect model is truncated to obtain several diffusion effect models distributed in several quadrants. The number of the several diffusion effect parameters obtained is controlled based on the third parameter in the frac function, and the third parameter is a constant greater than the preset value.

6. The method according to claim 5, characterized in that, After truncating the diffusion effect model based on the frac function to obtain several diffusion effect models distributed in several quadrants, the method further includes: By multiplying the diffusion effect models in different quadrants with different three-dimensional vectors, diffusion effect models of different shapes are obtained.

7. The method according to claim 1, characterized in that, After performing specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes: The diffusion effect model is distorted based on a preset manifold diagram to obtain a diffusion effect model with a distorted effect.

8. The method according to claim 7, characterized in that, The process of distorting the diffusion effect model based on the manifold diagram to obtain a diffusion effect model with a distorted effect includes: The manifold is superimposed on the texture coordinate system to obtain a distorted texture coordinate system; The specified operation is performed based on the distorted texture coordinate system to obtain the diffusion effect model with the distorted effect.

9. The method according to claim 8, characterized in that, The step of superimposing the manifold map with the texture coordinate system to obtain a distorted texture coordinate system includes: The manifold graph is multiplied by the fourth parameter and then superimposed on the texture coordinate system to obtain the distorted texture coordinate system; The fourth parameter is configured to control the degree of distortion of the distorted texture coordinate system.

10. The method according to claim 1, characterized in that, After performing specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes: Determine the pixel position and center position of the diffusion effect model; Based on the pixel position and the center position, a masking model is obtained; Based on the masking model, the central region of the diffusion effect model is controlled.

11. The method according to claim 1, characterized in that, After performing specified calculations based on the texture coordinate system to obtain the diffusion effect model, the method further includes: Identify the noisy image; The coordinates of the noise image are obtained based on the pixel positions on the screen; Based on the coordinates of the noise image, the noise image is superimposed on the diffusion effect model to obtain a diffusion effect model with a particle effect.

12. The method according to claim 11, characterized in that, The process of obtaining the coordinates of the noisy image based on the pixel position on the screen includes: Determine the pixel positions of the screen; The coordinates of the noise image are obtained by processing the pixel positions on the screen using the modulo function.

13. A device for generating a diffusion effect, characterized in that, include: The texture coordinate system determination module is configured to determine the texture coordinate system; The diffusion effect model generation module is configured to: for all texture horizontal coordinates in the texture coordinate system, determine a first difference obtained by subtracting the texture horizontal coordinate from a preset value; determine the maximum value between the first difference and the texture horizontal coordinate to obtain a first maximum value; for all texture vertical coordinates in the texture coordinate system, determine a second difference obtained by subtracting the texture vertical coordinate from the preset value; determine the maximum value between the second difference and the texture vertical coordinate to obtain a second maximum value; add all the first maximum values ​​and all the second maximum values ​​to obtain intermediate parameters; and process the intermediate parameters based on a specified function to obtain the diffusion effect model. The diffusion effect generation module is configured to map the diffusion effect model to a specified area to obtain a diffusion effect.

14. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as described in any one of claims 1 to 12.

15. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions for causing a computer to perform the method of any one of claims 1 to 12.

Citation Information

Patent Citations

  • Trimming method of detail level of 3D geometric virtual model based on point, line and surface

    CN109410332A

  • Diffusion effect rendering method and device, storage medium and electronic equipment

    CN116797701A