Scene special effect processing method and device, electronic equipment and readable storage medium
By determining the target scene unit and special effect grid in the virtual scene, and adding special effect textures using preset special effect maps, the problem of unnatural boundaries of scene effects in virtual games is solved, and the visual performance of special effects is improved.
Patent Information
- Application Number
- CN202411957880.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-26
AI Technical Summary
When the prior art generates scene special effects in virtual games, straight chamfers appear on the boundaries of grid cells, and the special effects transitions between adjacent grid cells are unnatural, resulting in a lack of clarity and fineness of the special effects.
By determining the target scene units and special effects grids in the virtual scene, obtain target effects information and obtain target effects maps from the preset set of special effects maps, and add target effects textures based on the special effects maps to render scene effects with natural style in the virtual scene.
The visual performance effect of scene special effects in virtual scenes is improved, making the edges of the special effects more natural and delicate, avoiding the problems of straight chamfers and texture repetition, and creating scene special effects with richer visual performance.
Smart Images

Figure CN119701341A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method, device, electronic device and computer-readable storage medium for processing scene special effects. Background Art
[0002] Currently, in virtual games, when special effects need to be added to a scene, the rendering engine will decide which parts of the virtual scene should have special effects and how the concentration of the special effects changes according to preset rules or algorithms. Then, the rendering engine will generate a grid area based on the area where the special effects are to be generated. Each vertex or face of each grid unit in this grid area will be assigned a certain attribute value (such as special effect color, special effect transparency, etc.) according to the above preset rules, and then interpolate the attribute values to obtain the special effect in each grid unit.
[0003] However, in the above method, each grid unit in the grid is usually a regular geometric shape, that is, the boundary of each grid unit is a straight line, which may cause the generated special effect boundary to have a straight chamfer, and the special effect transition between adjacent grid units is abrupt and lacks a natural feel; even if the special effects in the grid units are blurred, the special effects between adjacent grid units may have repeated textures, or the edge special effects may lose detail, making the special effects lack clarity and refinement; in addition, in the interpolation calculation process, it is easy to cause the special effects in each grid unit to be distributed more evenly, resulting in a relatively single special effect form in the special effect area.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] In view of this, the present application provides a method, device, electronic device and computer-readable storage medium for processing scene special effects, which can improve the visual performance of scene special effects in a virtual scene.
[0006] In a first aspect, an embodiment of the present application provides a method for processing scene special effects, the method comprising:
[0007] Determine a plurality of target scene units of a scene special effect to be processed in a virtual scene, and a special effect grid corresponding to the virtual scene, the special effect grid including a plurality of special effect units, and a scene special effect presenting a first performance effect in the virtual scene;
[0008] Determine a target special effect unit corresponding to the target scene unit among the multiple special effect units, and target special effect information corresponding to the target special effect unit; the target special effect information is used to indicate a target display area of the scene special effect in the special effect unit;
[0009] Obtaining a target special effect map corresponding to the target special effect information in a preset special effect map set; wherein the special effect map set includes different special effect maps corresponding to different target special effect information, and the special effect map is used to store stylized special effect textures;
[0010] According to the target special effect map, a target special effect texture is added to the special effect model corresponding to the target special effect unit to render and generate the scene special effect with a target expression style in the virtual scene; the target expression style matches the style of the special effect texture stored in the target special effect map.
[0011] In a second aspect, an embodiment of the present application provides a scene special effect processing device, the device comprising: a determination unit, an acquisition unit, and a generation unit;
[0012] A determination unit, used to determine a plurality of target scene units of a scene special effect to be processed in a virtual scene, and a special effect grid corresponding to the virtual scene, the special effect grid including a plurality of special effect units, and a scene special effect presenting a first performance effect in the virtual scene;
[0013] The determination unit is further used to determine a target special effect unit corresponding to the target scene unit in the plurality of special effect units, and target special effect information corresponding to the target special effect unit; the target special effect information is used to indicate a target display area of the scene special effect in the special effect unit;
[0014] The acquisition unit is further used to acquire a target special effect map corresponding to the target special effect information in a preset special effect map set; wherein the special effect map set includes different special effect maps corresponding to different target special effect information, and the special effect map is used to store stylized special effect textures;
[0015] A generating unit is used to add a target special effect texture to a special effect model corresponding to the target special effect unit according to a target special effect map, so as to render and generate the scene special effect with a target expression style in the virtual scene; the target expression style matches the style of the special effect texture stored in the target special effect map.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0017] Processor; and
[0018] The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method of the first aspect is executed.
[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a data processing program, which is executed by a processor to perform the method of the first aspect.
[0020] The method for processing scene special effects provided in the present application determines a plurality of target scene units of scene special effects to be processed in a virtual scene, and a special effect grid corresponding to the virtual scene, wherein the special effect grid includes a plurality of special effect units, and there is a corresponding relationship between each scene unit of the virtual scene and the special effect unit in the special effect grid; based on this, a target special effect unit corresponding to the target scene unit in the plurality of special effect units, and target special effect information corresponding to the target special effect unit are determined; the target special effect information is used to indicate a display area of the scene special effect in the target special effect unit; further, a target special effect map corresponding to the target special effect information in a preset special effect map set can be obtained; wherein the special effect map set includes different special effect maps corresponding to different special effect information, that is, the special effect textures in different special effect maps have different display areas in the corresponding maps; in addition, the special effect map stores stylized special effect textures, for example, the special effect texture boundary has a stylized expression, that is, the edge of the special effect texture in the special effect map is not stiff and the expression is natural; for another example, the stylized special effect texture in a special effect map has different texture density or transparency in different areas. Based on a target special effect map storing a stylized special effect texture, a target special effect texture is added to a special effect model corresponding to a target special effect unit to render and generate a scene special effect with a target expression style in a virtual scene; the target expression style matches the style of the special effect texture stored in the target special effect map.
[0021] It can be seen that since the special effect textures stored in each special effect map in the preset special effect map set have a stylized expression, after adding the target special effect texture to the special effect model in each target special effect unit according to the target special effect map, the surface texture of the special effect model in the target special effect unit has the above-mentioned stylized expression. For example, the edge of the surface texture of the special effect model has the above-mentioned stylized expression, thereby making the edges of the scene special effects generated in the virtual scene more natural and delicate, and avoiding the problems of straight line chamfers and texture repetition on the edges of the special effects expression generated in the related technology; in addition, when the stylized special effect texture stored in the target special effect map has different texture density or transparency in different areas, scene special effects with richer visual expression effects can be generated. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0023] Figure 1 A flowchart of an example of a method for processing scene special effects provided in an embodiment of the present application;
[0024] Figure 2 A schematic diagram of an example of a special effect grid provided in an embodiment of the present application;
[0025] Figure 3 A schematic diagram of an example of a preset special effect map set provided in an embodiment of the present application;
[0026] Figure 4 A schematic diagram of an example of when the special effect maps corresponding to adjacent special effect units provided in an embodiment of the present application are adjacent;
[0027] Figure 5 A schematic diagram of an example of determining a target special effect unit provided in an embodiment of the present application;
[0028] Figure 6 A schematic diagram of another example of a flow chart of a scene special effect processing method provided in an embodiment of the present application;
[0029] Figure 7 A schematic diagram of the structure of a scene special effects processing device provided in an embodiment of the present application;
[0030] Figure 8 A structural block diagram of an electronic device for implementing a scene special effects processing method is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0031] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0032] It should be noted that the terms "first", "second", "third", etc. in the claims, description and drawings of the present application are used to distinguish similar objects and are not used to describe a specific order or sequence. The data used in this way are interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including", "having" and their variants are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, "several" refers to one or more, and "multiple" refers to two or more. "And / or" is only a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "Including A, B and / or C" means including any one, any two, or any three of A, B, and C.
[0034] It should be understood that in the embodiments of the present application, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0035] Based on the problems existing in the related technologies described above, the embodiments of the present application provide a method, device, electronic device and computer-readable storage medium for processing scene special effects.
[0036] The processing method of the scene special effects provided in the embodiment of the present application can be performed by an electronic device, which can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, or a laptop computer. The server can be an independent physical server, or a server cluster or a 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 storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (such as software or software modules used to provide distributed services), or it can be implemented as a single software or software module. The embodiment of the present application does not specifically limit this.
[0037] It should be noted that in the embodiments of the present application, the execution subject of the scene special effect processing method can be a terminal device or a server, wherein the terminal device can be a local terminal device or a client device in the aforementioned cloud service system. The embodiments of the present application do not limit the type of the execution subject.
[0038] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. Figure 1 As shown, Figure 1 This is a flow chart of an example of a scene special effect processing method provided in an embodiment of the present application. It should be noted that the steps shown can be performed in a logical order different from that shown in the flow chart of the method. The method may include the following steps S110 to S140.
[0039] Step S110: determining a plurality of target scene units of the scene special effects to be processed in the virtual scene, and a special effects grid corresponding to the virtual scene, wherein the special effects grid includes a plurality of special effects units.
[0040] Step S120: determining a target special effect unit corresponding to the target scene unit among the multiple special effect units, and target special effect information corresponding to the target special effect unit; the target special effect information is used to indicate a display area of the scene special effect in the target special effect unit.
[0041] Step S130: obtaining a target special effect map corresponding to the target special effect information in a preset special effect map set; wherein the special effect map set includes special effect maps with different display areas of scene special effects corresponding to different special effect information, and the special effect map is used to store stylized special effect textures.
[0042] Step S140: according to the target special effect map, add a target special effect texture to the special effect model corresponding to the target special effect unit, so as to render and generate the scene special effect with a target expression style in the virtual scene; the target expression style matches the style of the special effect texture stored in the target special effect map.
[0043] Next, each of the above steps is described in detail.
[0044] With respect to the above step S110 , a plurality of target scene units of the scene special effects to be processed in the virtual scene and a special effects grid corresponding to the virtual scene are determined, and the special effects grid includes a plurality of special effects units.
[0045] In this embodiment, the virtual scene is divided into multiple scene units through a preset two-dimensional grid, wherein the scene unit refers to dividing the preset ground or a plane of the virtual scene into a series of minimum operating areas with a fixed size, wherein each minimum operating area can be called a scene unit; in this embodiment, the scene unit can be a quadrilateral, hexagon or other shapes, and in this embodiment, the scene unit is taken as a quadrilateral as an example.
[0046] The above virtual scene is a scene in which players complete the game logic in a virtual game. It can be a simulation environment of the real world in the game, a semi-simulation and semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, and a three-dimensional virtual scene, without specific limitation.
[0047] The above-mentioned scene special effects refer to dynamic or static effects used to enhance the visual effects in the virtual scene to enhance the immersion and visual appeal of the game. For example, the scene special effects may include but are not limited to: fog special effects, flame special effects, ice and snow special effects, haze special effects, sand special effects, etc., which are not specifically limited in this embodiment.
[0048] In this embodiment, the performance effect of the scene special effect refers to the visual effect presented by the scene special effect in the virtual scene. For example, when the scene special effect is a fog special effect, the performance effect of the fog special effect may include but is not limited to: the display area of the fog special effect in the virtual scene, display transparency, dynamic display or static display, etc., without specific restriction.
[0049] In this embodiment, each of the above-mentioned target scene units may present a scene effect with a certain visual expression effect in the game interface of the current frame, or may not display the scene effect. This embodiment does not specifically limit this.
[0050] The target scene unit is a scene unit to be processed with special effects among multiple scene units corresponding to the virtual scene. The number of the target scene unit can be one or more, which is not specifically limited in this embodiment. The specific determination method of the target scene unit can be referred to the detailed description below, which will not be repeated here.
[0051] The special effect grid corresponding to the above virtual scene is a two-dimensional grid for managing scene special effects in the virtual scene; wherein, the special effect grid may include multiple special effect units, and each special effect unit may include specific special effect information, for example, the special effect information may be used to characterize the display area of the scene special effect in the special effect unit; optionally, the special effect information may also be used to characterize the special effect type, display color, display transparency, display position and other information of the scene special effect in the special effect unit, without specific limitation. Generally, the special effect information of a single special effect unit may be processed separately to adjust the performance effect of the scene special effect indicated by the single special effect unit, thereby achieving the adjustment of the performance effect of the scene special effect of the virtual scene as a whole.
[0052] In this embodiment, there is a mapping relationship between the scene unit corresponding to the virtual scene and the special effect unit in the special effect grid. For example, it can be a mapping relationship of one scene unit corresponding to multiple special effect units, or it can be a mapping relationship of one special effect unit corresponding to multiple scene units. It can be specifically set according to actual needs.
[0053] In addition, it should be noted that, in this embodiment, the unit sizes of the scene unit and the special effect unit are the same.
[0054] In an optional specific embodiment, the above-mentioned determination of the special effects grid corresponding to the virtual scene can specifically be: generating the special effects grid corresponding to the virtual scene in real time according to each scene unit of the virtual scene, or obtaining a special effects grid preset for the virtual scene. In this embodiment, there is no specific restriction on whether the special effects grid is generated in real time or stored in advance. Specifically, the special effects grid corresponding to the virtual scene can be constructed in the following manner: obtaining the vertex position and scene unit size of each scene unit corresponding to the virtual scene; using the vertex position as the center position of the special effects unit to be generated, and the scene unit size of the scene unit as the special effects unit size of the special effects unit to be generated, generating multiple special effects units, and obtaining a special effects grid.
[0055] like Figure 2 As shown, Figure 2 The black solid line grid shown in (a) is the scene grid corresponding to the virtual scene. The number of scene units in the scene grid is 5×5, each scene unit is a square, and the side length of the scene unit is l. Based on the scene grid, the vertex of each scene unit in the scene grid (such as vertex a) is the center position of the special effect unit to be generated, and the side length l of the scene unit is the side length of the special effect unit to be generated. Then, Figure 2 The gray dotted grid shown in (b) generates multiple special effect units to obtain a special effect grid corresponding to the virtual scene. It can be seen that the center position of each special effect unit in the special effect grid shown by the gray dotted line is the vertex position of the scene unit, and the side length of each special effect unit is l.
[0056] It should be noted that the above Figure 2 The generation method of the special effect grid shown is only an example, and this embodiment does not specifically limit the generation method of the special effect grid.
[0057] With respect to the above step S120, the target special effect unit corresponding to the target scene unit in the multiple special effect units and the target special effect information corresponding to the target special effect unit are determined; the target special effect information is used to indicate the display area of the scene special effect in the special effect unit.
[0058] In this embodiment, since the special effects grid is generated based on the relevant unit attributes of each scene unit of the virtual scene, each scene unit of the virtual scene has a mapping relationship with each special effects unit in the special effects grid. Based on the mapping relationship between each scene unit and each special effects unit, the target special effects unit corresponding to each target scene unit can be determined in the special effects grid.
[0059] It should be noted that this embodiment does not specifically limit the number of special effect units corresponding to one special effect unit in the special effect grid, and it can be one-to-one, one-to-many, or many-to-one.
[0060] In an optional specific embodiment, a scene unit corresponds to multiple scene vertices. Based on this, "determining the target special effect unit corresponding to the target scene unit among the multiple special effect units" in step S120 can be specifically implemented through the following steps S121 to S122.
[0061] Step S121: for each target scene unit, determining the scene vertex of the target scene unit;
[0062] Step S122: determining the special effect unit with the scene vertex as the geometric center as the target special effect unit corresponding to the target scene unit among the multiple special effect units.
[0063] For example, Figure 2 As shown, one scene unit can correspond to four special effect units in the special effect grid, that is, one scene unit can have an associated relationship with four special effect units; assuming that the target scene unit is scene unit abcd, the scene unit abcd includes four scene vertices, namely vertex a, vertex b, vertex c and vertex d. Based on this, the target special effect units corresponding to the scene unit abcd in the special effect grid are: a special effect grid with vertex a as the center position, a special effect grid with vertex b as the center position, a special effect grid with vertex c as the center position, and a special effect grid with vertex d as the center position.
[0064] The target special effect information corresponding to the above-mentioned target special effect unit is used to indicate the target display area of the scene special effect in the target special effect unit, that is, to indicate which areas in the target special effect unit are to display the scene special effect and which areas are not to display the scene special effect. For example, when the scene special effect is displayed in a single special effect unit, its display situation can be divided into: the special effect unit fully displays the scene special effect, the special effect unit partially displays the scene special effect, and the special effect unit does not display the scene special effect. Among them, the special effect unit partially displays the scene special effect and can be further divided, for example, only displaying the scene special effect in the upper left corner of the special effect unit, only displaying the scene special effect in the upper right corner of the special effect unit, only displaying the scene special effect in the lower left corner of the special effect unit, only displaying the scene special effect in the lower right corner of the special effect unit, etc. There is no restriction on the specific display area of the scene special effect in the special effect unit.
[0065] In view of the above situation, the target special effect information corresponding to the target special effect unit can be represented by several bit characters, where when the bit character is "0", it indicates that the scene special effect is not displayed, and when the bit character is "1", it indicates that the scene special effect is displayed. Based on this, if the target special effect unit fully displays the scene special effect, the target special effect information corresponding to the target special effect unit can be "1"; if the target special effect unit does not display the scene special effect at all, the target special effect information corresponding to the target special effect unit can be "0"; if the target special effect unit partially displays the scene special effect, the target special effect information corresponding to the target special effect unit has the ability of position mapping, which is used to indicate the position of the special effect display area in the target special effect unit and the position of the special effect non-display area. At this time, it can be represented by multiple bit characters. For example, when the target special effect information corresponding to the target special effect unit is " 0010", it means that the target special effect unit can be divided into four parts, one part of which displays the scene special effect, and the other three parts do not display the scene special effect; it can be understood that if the target special effect unit fully displays the scene special effect, the target special effect information corresponding to the target special effect unit can also be "1111", and if the target special effect unit does not display the scene special effect at all, the target special effect information corresponding to the target special effect unit can also be "0000". The number of bit characters used to represent the target special effect information can be determined according to the number of area divisions of the target special effect unit, and this embodiment does not specifically limit it.
[0066] It should be noted that in some embodiments, there is no overlapping area between different parts of the special effect unit, and the parts in the special effect unit are arranged in a sequence, for example, from left to right, from top to bottom, clockwise, counterclockwise or serpentine, etc., which can be set according to actual needs.
[0067] For the specific method of determining the target special effect information corresponding to the target special effect unit, please refer to the introduction below and will not be described in detail here.
[0068] For the above step S130, a target special effect map corresponding to the target special effect information in a preset special effect map set is obtained; wherein the special effect map set includes different special effect maps corresponding to different special effect information, and the special effect map is used to store stylized special effect textures.
[0069] In this embodiment, the above-mentioned preset special effect map set includes different special effect maps corresponding to different target special effect information, wherein the special effect map is a two-dimensional image storing a stylized special effect texture of a scene special effect. Among them, the stylized special effect texture can be understood as: the texture density, transparency, edge blur degree and other properties of the special effect texture in a special effect map are all stylized. For example, the special effect texture has different densities and different transparency in different areas of the corresponding special effect map, and the edge has a stylized design, etc. This embodiment does not specifically limit this.
[0070] As described above, the target special effect information is used to indicate the target display area of the scene special effect in the special effect unit. Therefore, the display areas of the special effect texture in the special effect map corresponding to different target special effect information are not completely the same.
[0071] For example, assuming that the special effect unit is divided into four parts: the upper left corner, the upper right corner, the lower right corner and the lower left corner, the corresponding target special effect data may include the following 16 cases: 0000, 0001, 0010, 0100, 1000, 1100, 0110, 0011, 1001, 1010, 0101, 0111, 1110, 1011, 1101 and 1111; Figure 3 , Figure 3 A special effect map set of special effect maps pre-set for the above 16 target special effect data is provided; 0000 means that the special effect unit does not display the scene special effect at all, and the special effect texture of the scene special effect is not set in the corresponding special effect map ( Figure 30001 indicates that the scene special effect is displayed in the lower left corner of the special effect unit, and the rest of the area does not display the scene special effect. In the corresponding special effect map, only the lower left corner is set with the special effect texture; 0010 indicates that the scene special effect is displayed in the lower right corner of the special effect unit, and the rest of the area does not display the scene special effect. In the corresponding special effect map, only the lower right corner is set with the special effect texture; 0100 indicates that the scene special effect is displayed in the upper right corner of the special effect unit, and the rest of the area does not display the scene special effect. In the corresponding special effect map, only the upper right corner is set with the special effect texture; 1000 indicates that the scene special effect is displayed in the upper left corner of the special effect unit, and the rest of the area does not display the scene special effect. In the corresponding special effect map, only the upper left corner is set with the special effect texture; 1100 means that the upper left and upper right corners of the special effect unit display scene special effects, and the rest of the area does not display scene special effects, and the corresponding special effect map has special effect textures set in the upper left and upper right corners; 0110 means that the upper right and lower left corners of the special effect unit display scene special effects, and the rest of the area does not display scene special effects, and the corresponding special effect map has special effect textures set in the upper right and lower left corners; 0011 means that the lower right and lower left corners of the special effect unit display scene special effects, and the rest of the area does not display scene special effects, and the corresponding special effect map has special effect textures set in the lower right and lower left corners; 1001 means that the upper left and lower left corners of the special effect unit display scene special effects, and the rest of the area does not display scene special effects, and the corresponding special effect map has special effect textures set in the upper left and lower left corners. Special effect textures are set in the upper left corner and lower left corner of the special effect unit; 1010 means that the upper left corner and lower right corner of the special effect unit both display scene special effects, and the rest of the area does not display scene special effects, and the corresponding special effect map has special effect textures set in the upper left corner and lower right corner; 0101 means that the upper right corner and lower left corner of the special effect unit both display scene special effects, and the rest of the area does not display scene special effects, and the corresponding special effect map has special effect textures set in the upper right corner and lower left corner; 0111 means that the rest of the area except the upper left corner of the special effect unit displays scene special effects, and the upper left corner area does not display scene special effects, and the corresponding special effect map has special effect textures set in the rest of the area except the upper left corner; 1110 means that the rest of the area except the lower left corner of the special effect unit displays Scene special effects, the lower left corner area does not display scene special effects, and the corresponding special effects map has special effects textures in all areas except the lower left corner; 1011 means that the special effects unit displays scene special effects in all areas except the upper right corner, and the upper right corner area does not display scene special effects, and the corresponding special effects map has special effects textures in all areas except the upper right corner; 1101 means that the special effects unit displays scene special effects in all areas except the lower right corner, and the lower right corner area does not display scene special effects, and the corresponding special effects map has special effects textures in all areas except the lower right corner; 1111 means that the scene effects are fully displayed in the special effects unit, and all areas in the corresponding special effects map are set with special effects textures.
[0072] In addition, if Figure 3As shown, the borders of the special effect textures in each special effect map have stylized curve designs instead of rigid straight lines.
[0073] In an optional embodiment, in the special effect grid, the similarity of pixel values of special effect maps corresponding to target special effect information of adjacent special effect units on adjacent boundaries is greater than a preset similarity.
[0074] Among them, the above-mentioned adjacent special effects units refer to special effects units in the special effects grid that have shared edges and vertices; it should be noted that, in this embodiment, the similarity of pixel values of special effects maps corresponding to the target special effects information of adjacent special effects units on adjacent boundaries is greater than the preset similarity, or, in other words, the difference in pixel values is less than the preset difference, that is, the special effects maps corresponding to the target special effects information of adjacent special effects units can be seamlessly transitioned on adjacent boundaries, so that the special effects performance of the final generated scene special effects can be smoothly transitioned without seams, further refining the special effects performance of the scene special effects in the virtual scene, making the special effects performance of the scene special effects more delicate and natural.
[0075] For example, Figure 4 As shown, Figure 4 (a) provides four adjacent special effect units, and the target special effect information of these four special effect units is 0110, 1011, 1001, and 0100 respectively. Figure 3 Provided special effect map set, get the special effect map corresponding to each target special effect information 0110, 1011, 1001, 0100 respectively, then Figure 4 As shown in (b), the special effect maps corresponding to each target special effect information can be spliced according to the splicing relationship of each special effect unit. It can be found that the pixel values of adjacent special effect maps on adjacent boundaries can be connected and transitioned.
[0076] In summary, after determining the target special effect information of each target special effect unit, the target special effect map corresponding to the target special effect information can be obtained, and the display area of the scene special effect in each target special effect unit can be determined through the target special effect map.
[0077] For the above step S140, according to the target special effect map, the target special effect texture is added to the special effect model corresponding to the target special effect unit, so as to render and generate the scene special effect with the target expression style in the virtual scene; the target expression style matches the style of the special effect texture stored in the target special effect map.
[0078] In this embodiment, the special effects model corresponding to the above-mentioned target special effects unit can be understood as a model instance of a basic two-dimensional patch model set for the virtual scene, that is, different special effects models reference the model data of the same two-dimensional patch model. For example, the model vertices, model normals, model texture coordinates, etc. of different special effects models are the same, and only the model position, model scale and / or model orientation of the special effects model are different.
[0079] In other words, in this embodiment, only one basic graphic element (two-dimensional patch model) can be pre-set for the virtual scene, and the two-dimensional patch model corresponds to geometric information (such as vertices, normals, UV coordinates, etc.) and material information (such as special effect texture, color, etc.); when drawing special effects for each special effect grid, the two-dimensional patch model can be instantiated so that each special effect unit corresponds to a special effect model. The specific process of instantiation can be: setting specific attributes for the two-dimensional patch model, for example, setting attributes such as model position, model rotation, model scaling, and model texture, and obtaining a specific special effect model after setting. Among them, the above-mentioned model position is used to indicate the placement position of the special effect model obtained after instantiation. For example, in this embodiment, the model position can be the center position of the geometric center of each special effect unit; the above-mentioned model scaling is used to indicate the size of the special effect model obtained after instantiation. In this embodiment, the size of the special effect model corresponding to each special effect grid matches the unit size of the special effect unit.
[0080] According to the target special effect map, the target special effect texture is added to the special effect model corresponding to the target special effect unit. This can be simply understood as "pasting" part of the special effect texture stored in the target special effect map on the surface of the special effect model corresponding to the target special effect unit, so that the surface of the special effect model has the target special effect texture. In this way, a scene special effect with a target expression style can be rendered in the virtual scene, and the target expression style is consistent with the style of the special effect texture stored in the special effect map.
[0081] For the specific method of adding part of the special effect texture stored in the target special effect map to the surface of the special effect model corresponding to the target special effect unit, please refer to the introduction below and will not be described in detail here.
[0082] It can be seen that since the special effect textures stored in each special effect map in the preset special effect map set have a stylized expression, after adding the target special effect texture to the special effect model in each target special effect unit according to the target special effect map, the surface texture of the special effect model in the target special effect unit has the above-mentioned stylized expression. For example, the edge of the surface texture of the special effect model has the above-mentioned stylized expression, thereby making the edges of the scene special effects generated in the virtual scene more natural and delicate, and avoiding the problems of straight line chamfers and texture repetition on the edges of the special effects expression generated in the related technology; in addition, when the stylized special effect texture stored in the target special effect map has different texture density or transparency in different areas, scene special effects with richer visual expression effects can be generated.
[0083] In addition, since the textures of adjacent special effect maps in the preset special effect map set can be seamlessly connected on adjacent boundaries, after adjusting the surface texture of the special effect model in each target special effect unit according to each special effect map in the special effect map set, the special effect textures of the special effect models in each adjacent special effect unit in the special effect grid can be smoothly transitioned, thereby making the visual expression effect of the scene special effects generated in the virtual scene more delicate.
[0084] Next, the processing method for scene special effects provided by the present application is further described in detail. As described above, each special effect unit in the special effect grid stores corresponding special effect information. Therefore, after determining the target special effect unit corresponding to the target scene unit, the target special effect information corresponding to the target special effect unit can be further determined.
[0085] It is understandable that a single special effect unit may include multiple special effect vertices. In this embodiment, each special effect vertex of the special effect unit may correspond to a unit area. In this way, the display status of the scene special effect in the corresponding unit area may be indicated by the vertex information corresponding to each special effect vertex, thereby realizing the control of the display area of the scene special effect in the special effect unit by the vertex information corresponding to each special effect vertex. That is, the target special effect information of the special effect unit described above is the information composed of the vertex information of each special effect vertex. For example, if the target special effect information corresponding to a special effect unit is "1100", it means that the special effect unit includes four special effect vertices, and the vertex information of each special effect vertex is 1, 1, 0, 0 respectively.
[0086] Based on the above description, in some optional embodiments, each special effect vertex corresponds to a first special effect information; the first special effect information is used to indicate the first display state of the scene special effect in the unit area corresponding to the special effect vertex in the special effect unit; in this scenario, the "determining the target special effect information corresponding to the target special effect unit" in the above step S120 can be specifically implemented through the following steps S123 to S125.
[0087] Step S123: determining a first special effect vertex among a plurality of special effect vertices of a target special effect unit; the first special effect vertex is located inside a target scene unit corresponding to the target special effect unit.
[0088] Step S124: adjusting the first special effect information corresponding to the first special effect vertex to the second special effect information; the second special effect information is used to indicate the second display state of the scene special effect in the unit area corresponding to the first special effect vertex in the target special effect unit.
[0089] Step S125: determine the second special effect information stored in the first special effect vertex and the first special effect information corresponding to the second special effect vertex as the target special effect information corresponding to the target special effect unit; the second special effect vertex is located outside the target scene unit corresponding to the target special effect unit.
[0090] In this embodiment, the first special effect information corresponding to each of the special effect vertices is used to indicate the first display state of the scene special effect in the unit area corresponding to the special effect vertex in the special effect unit, that is, to indicate the current display state of the scene special effect in each unit area.
[0091] It should be noted that the first special effect information corresponding to different special effect vertices can be the same or different. For example, for a certain target special effect unit, it corresponds to four special effect vertices, and the first special effect information corresponding to the four special effect vertices can be: 0, 1, 1, 0. In this way, the current display status of each unit area in the target special effect unit of the scene special effect can be represented as: not displayed, displayed, displayed, and not displayed.
[0092] As introduced above, the center position of the special effect unit is the vertex position of the corresponding scene unit, so some special effect vertices of the special effect unit can be located inside the corresponding scene unit, and some special effect vertices can be located outside the corresponding scene unit. In this embodiment, the special effect vertex located inside the target scene unit among the multiple special effect vertices corresponding to the target special effect unit is called the first special effect vertex, and the special effect vertex located outside the target scene unit is called the second special effect vertex.
[0093] The above-mentioned adjustment of the first special effect information corresponding to the first special effect vertex to the second special effect information can be understood as adjusting the special effect information currently corresponding to the first special effect vertex to the target special effect information. In this embodiment, "first" and "second" are used to distinguish the current special effect information from the target special effect information to be adjusted. It can be understood that the first special effect information and the second special effect information can be the same or different, and there is no limitation on this.
[0094] Specifically, the second special effect information is used to indicate a second display state of the scene special effect in the unit area corresponding to the first special effect vertex in the target special effect unit. The second display state is usually different from the first display state described above.
[0095] In some embodiments of the present invention, the display state of the scene special effects in a certain unit area may include display and non-display, then the above-mentioned first display state may be display, and the second display state may be non-display; when the above-mentioned first display state is non-display, the above-mentioned second display state is display.
[0096] That is, after the first special effect information of the special effect vertex of the target special effect unit located inside the target scene unit is adjusted to the second special effect information, the first special effect vertex corresponds to the second special effect information, and the second special effect vertex corresponds to the first special effect information. At this time, the second special effect information corresponding to the first special effect vertex and the first special effect information corresponding to the second special effect vertex are determined as the target special effect information corresponding to the target special effect unit.
[0097] like Figure 5 As shown, assuming that the target scene unit is the scene unit abcd in the scene grid, its corresponding target special effect units in the special effect grid include: special effect unit efml, special effect unit fghm, special effect unit mhij and special effect unit lmjk;
[0098] Among them, the special effect vertices corresponding to each target special effect unit include: special effect vertex e, special effect vertex f, special effect vertex g, special effect vertex h, special effect vertex i, special effect vertex j, special effect vertex k, special effect vertex l and special effect vertex m; among them, special effect unit efml, special effect unit fghm, special effect unit mhij and special effect unit lmjk share a special effect vertex m, and the special effect vertex m is located inside the target scene unit abcd, then the special effect vertex m can be determined as the first special effect vertex, and the special effect vertex e, special effect vertex f, special effect vertex g, special effect vertex h, special effect vertex i, special effect vertex j, special effect vertex k and special effect vertex l can be determined as the second special effect vertex.
[0099] As shown in Table 1, Table 1 provides examples of first special effect information and second special effect information corresponding to special effect vertices e to special effect vertices m.
[0100] Table 1 Examples of first special effect information and second special effect information corresponding to special effect vertices e to m
[0101] Special Effects Vertex First special effect information Second special effect information Special effects vertex e, 0 0 Special effects vertex f 0 0 Special effects vertex g 0 0 Special effects vertex h 0 0 Special Effects Vertex I 0 0 Special Effects Vertex J 0 0 Special effects vertex k 0 0 Special Effects Vertex 0 0 Special effects vertex m 0 1
[0102] As shown in Table 1, the first special effect information corresponding to each special effect vertex is 0, which means that no scene special effects are currently displayed in each target special effect unit. At this time, the first special effect information of the first special effect vertex m can be adjusted to the second special effect information, that is, adjusted from 0 to 1, then the target special effect information corresponding to the special effect unit efml is 0010, the target special effect information corresponding to the special effect unit fghm is 0001, the target special effect information corresponding to the special effect unit mhij is 1000, and the target special effect information corresponding to the special effect unit lmjk is 0100.
[0103] The method for determining the target special effect information shown in the above steps S123 to S125 is only an example and does not constitute a specific limitation to the present application.
[0104] Next, combine Figure 6 And a specific example is given to describe in detail the processing method of the scene special effects provided by this application.
[0105] like Figure 6 As shown in (a), Figure 6 (a) provides a virtual scene presenting a scene effect in a first performance effect, based on the Figure 6 In the virtual scene shown in (a), assuming that the player applies an elimination operation to the target scene unit (i.e., the scene unit displaying the smiley face logo), the elimination operation is used to delete the smiley face logo so that the smiley face logo is invisible in the virtual scene. The triggering operation (such as multiple sliding operations, clicking operations, etc.) can be as follows Figure 6 As shown in (b), four target special effect units corresponding to the target scene unit (such as the four special effect units shown in the black bold dashed box) are determined in the special effect grid corresponding to the virtual scene;
[0106] The special effect information corresponding to each special effect unit in the special effect grid corresponding to the virtual scene presenting the scene special effect in the first performance effect can refer to Figure 6 As shown in (c), the special effect information currently corresponding to the above target special effect units are: 0000, 0000, 0010 and 0011. Based on this, the target special effect information corresponding to each target special effect unit can be further determined by the above-mentioned method for determining the target special effect information, that is, Figure 6 As shown in (d), the target special effect information corresponding to each target special effect unit can be 0010, 0001, 0110 and 1011 respectively, and the target map corresponding to each target special effect information is as follows Figure 6 The special effect map in each target special effect unit shown in (d);
[0107] Based on this, the following can be rendered based on the target special effect maps corresponding to each target special effect unit: Figure 6In the virtual scene shown in (e), at this time, the second expression effect of the scene special effect is presented in the virtual scene, that is, after the smiley face logo is eliminated, the scene special effect is generated in the scene unit to which the smiley face logo belongs, so that the expression effect of the scene special effect in the virtual scene is adjusted from the first expression effect to the second expression effect.
[0108] The remaining implementation methods of the scene special effects performance provided by this application are further described in detail below.
[0109] In some optional implementations, the above-described step S140 may be specifically implemented through the following steps S141 to S143.
[0110] Step S141: Determine the first texture coordinate of the special effect model corresponding to the target special effect unit.
[0111] Step S142: sampling the target special effect map corresponding to the target special effect unit according to the first texture coordinates to obtain first texture information.
[0112] Step S143: Rendering is performed according to the first texture information to add the target special effect texture to the special effect model corresponding to the target special effect unit.
[0113] The first texture coordinate of the special effects model corresponding to the above-mentioned target special effects unit refers to a coordinate system used to map the texture information stored in the special effects map to its corresponding two-dimensional face model instance, specifically used to specify the position of each vertex on the surface of the two-dimensional face model instance of the target special effects unit in its corresponding special effects map.
[0114] In an optional specific embodiment, the first texture coordinate of the special effects model corresponding to the target special effects unit can specifically be a preset texture coordinate corresponding to a two-dimensional patch model preset for the special effects grid. As described above, the two-dimensional patch model does not have a special effects texture.
[0115] It should be noted that, as described above, the special effects models corresponding to each special effects unit in the special effects grid all reference the same two-dimensional patch model. Therefore, the first texture coordinates of the special effects models corresponding to each target special effects unit are the same. However, since the target special effects maps corresponding to each target special effects unit are different, the texture information of the special effects models corresponding to each target special effects unit may be different.
[0116] Based on the first texture coordinates of the special effects model corresponding to each target special effects unit, the target special effects map corresponding to each target special effects unit can be sampled respectively, that is, the pixel values of the pixels at the corresponding positions of the first texture coordinates in the target special effects map are obtained. These sampled pixel values can constitute the first texture information corresponding to each target special effects unit respectively. Furthermore, rendering according to the first texture information can realize pasting at least part of the special effects texture stored in the target special effects map on the surface of the special effects model, so that the surface of the special effects model has the target special effects texture, thereby generating a scene special effect with a target performance style in the virtual scene.
[0117] The first texture information can be used to indicate the texture display area and display color of the target special effect texture on the surface of the special effect model. The display color can be consistent with the color of the special effect texture in the target special effect map, which will not be described in detail.
[0118] In some optional embodiments, a flow effect may be further added to the special effect texture on the surface of the special effect model of the target special effect unit. That is, the "rendering according to the first texture information to add the target special effect texture to the special effect model corresponding to the target special effect unit" in the above step S143 may be specifically implemented through the following steps S10 to S30.
[0119] Step S10: determining the second texture coordinates of the special effect model corresponding to the target special effect unit, and the special effect models corresponding to different target special effect units have different second texture coordinates.
[0120] Step S20 determines the special effect flow information corresponding to the target special effect unit according to the second texture coordinates and the flow field map corresponding to the scene special effect, and the flow field map is used to store the special effect flow information of the scene special effect.
[0121] Step S30: Rendering is performed according to the special effect flow information and the first texture information, so as to add the target special effect texture with the flow effect to the special effect model corresponding to the target special effect unit.
[0122] In this embodiment, the second texture coordinates of the special effect model corresponding to the target special effect unit are texture coordinates used to sample flow information.
[0123] As described above, the first texture coordinates of the special effects models corresponding to different target special effects units are the same. If different special effects models use the same first texture coordinates to sample the same preset flow field map, the sampling flow information is limited to the same area in the flow field map, which makes the special effects texture flow effects of different target special effects units exactly the same, which is visually monotonous, lacks naturalness and dynamics, and reduces the realism of the scene special effects.
[0124] Therefore, in an embodiment of the present application, the second texture coordinates of the special effects model corresponding to the target special effects unit are further determined so that the second texture coordinates corresponding to different target special effects units are different. However, this embodiment does not exclude the situation where the second texture coordinates corresponding to different target special effects units are the same.
[0125] The specific method for determining the second texture coordinates can be found in the following description and will not be described in detail here.
[0126] The flow map corresponding to the above scene effects is pre-drawn according to the flow effects required by the scene effects. The flow map is a two-dimensional image used to simulate the flow effect of the surface effect texture of a three-dimensional model or a two-dimensional model. For example, it can be used to achieve fluid effects such as rivers, waves, waterfalls, flames, fog, etc. in games.
[0127] The pixel value of each pixel in the flow field map is used to indicate flow information such as flow direction and flow speed at the corresponding pixel position. That is, in this embodiment, the flow field map is used to store special effect flow information of scene special effects. The flow field map is not specifically introduced in this embodiment.
[0128] The special effect flow information corresponding to the target special effect unit is determined according to the flow field map corresponding to the second texture coordinates and the scene special effect. Specifically, the flow field map is sampled according to the second texture coordinates, and further, the special effect flow information of the target special effect unit is determined according to the sampled pixel values. Exemplarily, the flow direction and flow speed of the special effect texture on the surface of the special effect model of the target special effect unit can be determined by the sampled pixel values.
[0129] The above rendering is performed according to the special effect flow information and the first texture information, that is, special effect flow information is added to the first texture information, so that the target special effect texture added to the surface of the special effect model has a flow effect, thereby generating a dynamic scene special effect with a target performance style in the virtual scene.
[0130] In an optional specific embodiment, "determining the second texture coordinates of the special effect model corresponding to the target special effect unit" in the above step S10 can be specifically implemented through the following steps S11 to S12.
[0131] Step S1: Obtain the cell coordinates of the target special effect unit in the special effect grid;
[0132] Step S2: obtaining preset texture coordinates of a two-dimensional patch model corresponding to the special effect grid; the two-dimensional patch model is a special effect model without special effect texture;
[0133] Step S3: Determine the second texture coordinates of the target special effect unit according to the preset texture coordinates and the cell coordinates.
[0134] As described herein, the special effect models corresponding to each special effect unit all reference the model data of the same two-dimensional surface model. Therefore, the second texture coordinates of each special effect model can be calculated based on the preset texture coordinates of the referenced two-dimensional surface model.
[0135] The cell coordinates of the target special effect unit in the special effect grid can be understood as the row and column coordinates of the target special effect unit in the special effect grid, that is, the row and column coordinates indicating the row and column of the target special effect unit in the special effect grid. Figure 6 As shown in (b), the cell coordinates of the four target special effect grids are (2,3), (2,4), (3,3), and (3,4), respectively, where (2,3) indicates that a target special effect unit is located in the second row and third column of the special effect grid, (2,4) indicates that a target special effect unit is located in the second row and fourth column of the special effect grid, (3,3) indicates that a target special effect unit is located in the third row and third column of the special effect grid, and (3,4) indicates that a target special effect unit is located in the third row and fourth column of the special effect grid.
[0136] In an optional specific embodiment, when the cell coordinates of the target special effect unit in the special effect grid and the preset texture coordinates of the two-dimensional patch model are known, the second texture coordinates corresponding to each target special effect unit can be calculated by the following formula (1) and formula (2).
[0137] UV [u] =UV.u×rcp(m)+coord.x×rcp(m) (Formula 1)
[0138] UV [v] =UV.v×rcp(m)+0.5+(coord.y-0.5n)×rcp(m) (Formula 2)
[0139] Wherein, formula (1) is used to calculate the horizontal texture coordinate U in the second texture coordinate of each target special effect unit; UV [u] That is, it represents the horizontal texture coordinate in the second texture coordinate of the target special effect unit; UV.u represents the horizontal texture coordinate in the preset texture coordinate of the two-dimensional patch model; rcp(m) is the scaling factor used to scale the preset texture coordinate of the two-dimensional patch model, rcp(m) is 1 / m, m is the number of columns in the special effect grid, that is, the number of special effect units in the horizontal direction in the special effect grid; UV.U×rcp(m) is used to evenly distribute the horizontal texture coordinates in the preset texture coordinates of the two-dimensional patch model in m equally divided intervals, that is, to evenly distribute the horizontal texture coordinates in the preset texture coordinates of the two-dimensional patch model in each special effect unit; coord.x is the x component in the cell coordinates used to characterize each special effect unit.
[0140] Formula (2) is used to calculate the vertical texture coordinate V in the second texture coordinate of each target special effect unit. [v] That is, it represents the longitudinal texture coordinate in the second texture coordinate of the target special effect unit; UV.v represents the longitudinal texture coordinate in the preset texture coordinate of the two-dimensional patch model; coord.y is the y component in the cell coordinate used to characterize each special effect cell; n is used to represent the number of rows in the special effect grid, the number of special effect units in the longitudinal direction in the special effect grid.
[0141] By using formula (1) and formula (2), the preset texture coordinates of the two-dimensional patch model can be scaled and offset so that the second texture coordinates of the special effect model of each target special effect unit occupy different areas in the flow field map, that is, the second texture coordinates of each target special effect unit are ensured to be evenly distributed in the flow field map, and the resolution of the flow field map is fully utilized, thereby generating different second texture coordinates for different target special effect units, which is convenient for subsequent sampling of flow information in different areas of the same flow field map, so that diversified flow effects can be generated for multiple target special effect units, thereby enriching the visual flow effect of the scene special effect and generating more stylized scene special effects.
[0142] In some optional embodiments, in the above step S30, "rendering according to the special effect flow information and the first texture information to add the target special effect texture with the flow effect to the special effect model corresponding to the target special effect unit" can be specifically implemented through the following steps S31 to S33.
[0143] Step S31: controlling the first texture coordinates to shift according to the special effect flow information to obtain the first texture coordinates after shifting;
[0144] Step S32: sampling the target special effect map corresponding to the target special effect unit according to the offset first texture coordinates to obtain first texture information with a flow effect;
[0145] Step S33: Rendering is performed according to the first texture information with the flow effect, so as to add the target special effect texture with the flow effect to the special effect model corresponding to the target special effect unit.
[0146] As described above, the special effect flow information may include flow direction and flow speed. Therefore, based on the flow direction and flow speed at each pixel point of the two-dimensional patch model obtained by sampling and combined with the time node, the first texture coordinates corresponding to each pixel point can be controlled to be offset according to the corresponding flow direction and flow speed, respectively, to obtain the offset first texture coordinates corresponding to different time nodes.
[0147] By sampling the target special effect map according to the offset first texture coordinates corresponding to each time node, it is possible to obtain first texture information that changes with the change of the time node, that is, to obtain first texture information with a flow effect, thereby rendering according to the first texture information with a flow effect to generate a target special effect texture with a flow effect on the surface of the special effect model corresponding to the target special effect unit, thereby generating a scene special effect with a flow effect in each target scene unit in the virtual scene.
[0148] It should be noted that, in the present embodiment, when adding flow effects to the target special effects textures on the surfaces of special effects models corresponding to different target special effects units, the special effects flow information is sampled through the same flow field map. In this way, only one flow field map can be stored, thereby reducing the memory usage of the electronic device. In addition, it can ensure that the visual flow styles of the target special effects textures on the surfaces of special effects models in different special effects units are consistent, thereby improving the consistency of the flow performance effects of the scene special effects in the virtual scene.
[0149] In some optional embodiments, in addition to adding a flow effect to the second special effect texture, the target color and texture repetition of the target special effect texture to be added to the surface of the special effect model corresponding to the target special effect unit may be further adjusted. That is, in the above step S30, "rendering according to the special effect flow information and the first texture information to add the target special effect texture with a flow effect to the special effect model corresponding to the target special effect unit" may be specifically implemented through the following steps S34 to S36.
[0150] Step S34: according to the special effect flow information, the second texture coordinates are controlled to be offset to obtain the offset second texture coordinates.
[0151] Step S35: sampling the basic color map corresponding to the scene special effect according to the offset second texture coordinates to obtain second texture information having the special effect flow information; the second texture information is used to indicate the target color of the second special effect texture.
[0152] Step S36: Rendering is performed according to the first texture information and the second texture information with the flow effect, so as to add the target special effect texture with the flow effect and the target color to the special effect model corresponding to the target special effect unit.
[0153] It should be noted that the purpose of steps S34 to S36 is to use a preset basic color map to unify the target colors of the special effects textures to be added to the surface of the special effects model, so that the target color style of the special effects textures on the surface of the special effects model corresponding to each target special effects unit is consistent, and to further refine the details of the special effects textures on the surface of each special effects model, reduce the repetitive feeling brought by the limited special effects textures provided by the limited special effects maps, and increase the detail level of the target special effects textures on the surface of each special effects model.
[0154] The base color map (BaseColor map) corresponding to the above scene special effects is used to define the target color of the surface of each special effect model. The target color can further affect the texture visual effect of the special effect texture on the surface of each special effect model.
[0155] In this embodiment, the special effect flow information can be used to control the second texture coordinates of the special effect model of each target special effect unit to be offset according to the flow direction and flow speed corresponding to different time nodes, so as to obtain the offset second texture coordinates corresponding to different time nodes; then the offset second texture coordinates can be used to sample the preset basic color map to obtain the second texture information that changes with the time node, that is, to obtain the second texture information with the flow effect, so that in the rendering process, the sampled second texture information with the flow effect and the first texture information used to indicate the display area of the second special effect texture to be generated are merged to add the target special effect texture with the flow effect and the target color to the special effect model corresponding to the target special effect unit. It can be understood that the target color is the color obtained by superimposing the color in the first texture information and the color in the second texture information.
[0156] It should be noted that, referring to the previous description of the calculation process of the second texture coordinates, the second texture coordinates can occupy different map areas in the same basic color map, that is, the second texture coordinates corresponding to each target special effect unit are evenly distributed in the same basic color map. Therefore, the special effects models of different target special effects units can sample the color information of different areas in the same flow field map, so that diversified color effects can be generated for multiple target special effects units, so as to enrich the visual texture effects of the scene special effects and generate more stylized scene special effects.
[0157] It should be noted that, in the present embodiment, when adjusting the target color of the special effect texture on the surface of the special effect model corresponding to different target special effect units, the second texture information is sampled through the same basic color map. In this way, only one basic color map can be stored to reduce the memory usage of the electronic device. In addition, the color style of the second special effect texture on the surface of the special effect model in different special effect units can be ensured to be consistent, which can improve the consistency of the visual expression effect of the scene special effects in the virtual scene.
[0158] So far, the method provided in the present embodiment has been described. The method for processing scene special effects provided in the present application has a stylized expression in which the special effect textures stored in each special effect map in a preset special effect map set have a stylized expression. Therefore, after adding the target special effect texture to the special effect model in each target special effect unit according to the target special effect map, the surface texture of the special effect model in the target special effect unit has the above-mentioned stylized expression. For example, the edge of the surface texture of the special effect model has the above-mentioned stylized expression, thereby making the edge of the scene special effect generated in the virtual scene more natural and delicate, and avoiding the problems of straight line chamfers and texture repetition on the edges of the special effects expression generated in the related art. In addition, when the texture density or transparency of the stylized special effect texture stored in the target special effect map is different in different areas, a scene special effect with richer visual expression can be generated.
[0159] At the same time, since the textures of adjacent special effect maps in the preset special effect map set can be seamlessly connected on adjacent boundaries, after adjusting the surface texture of the special effect model in each target special effect unit according to each special effect map in the special effect map set, the special effect textures of the special effect models in each adjacent special effect unit in the special effect grid can be smoothly transitioned, thereby making the visual expression effect of the scene special effects generated in the virtual scene more delicate.
[0160] In addition, flow effects and / or target colors can be added to the special effects textures on the surfaces of the special effects models of different special effects units respectively. Compared with the prior art of rendering using the entire rendering target, the scene special effects processing method provided in the present application is more flexible, and only the special effects textures on the surfaces of the special effects models corresponding to the special effects units corresponding to the partial scene units to be adjusted need to be adjusted.
[0161] It should be noted that in each drawing, the same pattern represents the same element. Therefore, each pattern is labeled when it first appears, and when it appears in subsequent drawings, although it is not labeled, the description in the previous drawings can be referred to.
[0162] Corresponding to the method for processing scene special effects provided in the embodiment of the present application, the embodiment of the present application also provides a device 1000 for processing scene special effects, such as Figure 7 As shown, the device 1000 includes: a determining unit 1001, an acquiring unit 1002 and a generating unit 1003;
[0163] The determining unit 1001 is used to determine a plurality of target scene units of a scene special effect to be processed in a virtual scene, and a special effect grid corresponding to the virtual scene, the special effect grid including a plurality of special effect units, and the scene special effect presenting a first performance effect in the virtual scene;
[0164] The determining unit 1001 is further used to determine a target special effect unit corresponding to the target scene unit among the multiple special effect units, and target special effect information corresponding to the target special effect unit; the target special effect information is used to indicate a target display area of the scene special effect in the special effect unit;
[0165] The acquisition unit 1002 is further used to acquire a target special effect map corresponding to the target special effect information in a preset special effect map set; wherein the special effect map set includes different special effect maps corresponding to different target special effect information, and the special effect map is used to store stylized special effect textures;
[0166] The generating unit 1003 is used to add a target special effect texture to the special effect model corresponding to the target special effect unit according to the target special effect map, so as to render and generate the scene special effect with a target expression style in the virtual scene; the target expression style matches the style of the special effect texture stored in the target special effect map.
[0167] Optionally, in the special effect grid, similarity of pixel values of the special effect maps corresponding to the target special effect information of adjacent special effect units on adjacent boundaries is greater than a preset similarity.
[0168] Optionally, one of the target scene units includes a plurality of scene vertices;
[0169] The determination unit 1001 is specifically used to determine the scene vertex of the target scene unit for each target scene unit; and determine the special effect unit with the scene vertex as the geometric center as the target special effect unit corresponding to the target scene unit among the multiple special effect units.
[0170] Optionally, one of the special effect units includes a plurality of special effect vertices, each of the special effect vertices corresponds to first special effect information; the first special effect information is used to indicate a first display state of the scene special effect in a unit area corresponding to the special effect vertex in the special effect unit;
[0171] Determination unit 1001 is specifically used to determine the first special effect vertex among the multiple special effect vertices of the target special effect unit; the first special effect vertex is located inside the target scene unit corresponding to the target special effect unit; the first special effect information corresponding to the first special effect vertex is adjusted to the second special effect information; the second special effect information is used to indicate the second display state of the scene special effect in the unit area corresponding to the first special effect vertex in the target special effect unit; the second special effect information corresponding to the first special effect vertex and the first special effect information corresponding to the second special effect vertex are determined as the target special effect information corresponding to the target special effect unit; the second special effect vertex is located outside the target scene unit corresponding to the target special effect unit.
[0172] Optionally, generation unit 1003 is specifically used to determine a first texture coordinate of a special effects model corresponding to the target special effects unit; sample the target special effects map corresponding to the target special effects unit according to the first texture coordinate to obtain first texture information; render according to the first texture information to add the target special effects texture to the special effects model corresponding to the target special effects unit; the texture features of the target special effects texture are at least partially the same as the texture features of the special effects texture stored in the target special effects map.
[0173] Optionally, the generation unit 1003 is further specifically used to determine the preset texture coordinates corresponding to the preset two-dimensional patch model as the first texture coordinates of the special effects model corresponding to the target special effects unit; the two-dimensional patch model is the special effects model without special effects texture.
[0174] Optionally, generation unit 1003 is specifically used to determine the second texture coordinates of the special effects model corresponding to the target special effects unit; the special effects models corresponding to different target special effects units have different second texture coordinates; the special effects flow information corresponding to the target special effects unit is determined according to the second texture coordinates and the flow field map corresponding to the scene special effect, and the flow field map is used to store the special effects flow information of the scene special effect; rendering is performed according to the special effects flow information and the first texture information to add the target special effects texture with a flow effect to the special effects model corresponding to the target special effects unit.
[0175] Optionally, generation unit 1003 is further specifically used to obtain the cell coordinates of the target special effect unit in the special effect grid; obtain the preset texture coordinates of the two-dimensional patch model corresponding to the special effect grid; the two-dimensional patch model is the special effect model without special effect texture; and determine the second texture coordinates of the target special effect unit according to the preset texture coordinates and the cell coordinates.
[0176] Optionally, generation unit 1003 is specifically used to control the offset of the first texture coordinates according to the special effect flow information to obtain the offset first texture coordinates; sample the target special effect map corresponding to the target special effect unit according to the offset first texture coordinates to obtain the first texture information with the flow effect; and render according to the first texture information with the flow effect to add the target special effect texture with the flow effect to the special effect model corresponding to the target special effect unit.
[0177] Optionally, the generation unit 1003 is specifically used to control the offset of the second texture coordinates according to the special effect flow information to obtain the offset second texture coordinates; sample the basic color map corresponding to the scene special effect according to the offset second texture coordinates to obtain the second texture information with a flow effect; the second texture information is used to indicate the target color of the second special effect texture; and render according to the first texture information and the second texture information with a flow effect to add the target special effect texture with a flow effect and the target color to the special effect model corresponding to the target special effect unit.
[0178] Optionally, determination unit 1001 is specifically used to obtain the vertex position and scene unit size of each scene unit corresponding to the virtual scene; taking the vertex position as the center position of the special effect unit to be generated, and the scene unit size of the scene unit as the special effect unit size of the special effect unit to be generated, a plurality of the special effect units are generated to obtain the special effect grid.
[0179] Corresponding to a scene special effect processing method provided in an embodiment of the present application, an electronic device 2000 for implementing the scene special effect processing method is also provided in an embodiment of the present application. Figure 8 As shown, the electronic device 2000 includes: a processor 2001; and a memory 2002, which is used to store a program of a method for processing scene special effects. After the device is powered on and runs the program of the method for processing scene special effects through the processor, the method steps in any of the above-mentioned method embodiments of the method for processing scene special effects can be executed. For example, the following steps can be executed:
[0180] Determine a plurality of target scene units of a scene special effect to be processed in a virtual scene, and a special effect grid corresponding to the virtual scene, the special effect grid including a plurality of special effect units, and the scene special effect presenting a first performance effect in the virtual scene;
[0181] Determine a target special effect unit corresponding to the target scene unit among the multiple special effect units, and target special effect information corresponding to the target special effect unit; the target special effect information is used to indicate a target display area of the scene special effect in the special effect unit;
[0182] Obtaining a target special effect map corresponding to the target special effect information in a preset special effect map set; wherein the special effect map set includes different special effect maps corresponding to different target special effect information, and the special effect map is used to store stylized special effect textures;
[0183] According to the target special effect map, a target special effect texture is added to the special effect model corresponding to the target special effect unit to render and generate the scene special effect with a target expression style in the virtual scene; the target expression style matches the style of the special effect texture stored in the target special effect map.
[0184] Corresponding to the scene special effect processing method provided in the embodiment of the present application, the embodiment of the present application further provides a computer-readable storage medium storing a program of the scene special effect processing method, the program is executed by a processor, and the method steps in any embodiment of the method embodiment of the scene special effect processing method can be executed, for example, the following steps can be executed:
[0185] Determine a plurality of target scene units of a scene special effect to be processed in a virtual scene, and a special effect grid corresponding to the virtual scene, the special effect grid including a plurality of special effect units, and the scene special effect presenting a first performance effect in the virtual scene;
[0186] Determine a target special effect unit corresponding to the target scene unit among the multiple special effect units, and target special effect information corresponding to the target special effect unit; the target special effect information is used to indicate a target display area of the scene special effect in the special effect unit;
[0187] Obtaining a target special effect map corresponding to the target special effect information in a preset special effect map set; wherein the special effect map set includes different special effect maps corresponding to different target special effect information, and the special effect map is used to store stylized special effect textures;
[0188] According to the target special effect map, a target special effect texture is added to the special effect model corresponding to the target special effect unit to render and generate the scene special effect with a target expression style in the virtual scene; the target expression style matches the style of the special effect texture stored in the target special effect map.
[0189] It should be noted that for the detailed description of the device, electronic device and computer-readable storage medium provided in the embodiments of the present application, reference can be made to the relevant description of the embodiment of the method for processing scene special effects provided in the embodiments of the present application, which will not be repeated here.
[0190] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
[0191] In a typical configuration, an electronic device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0192] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0193] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable operations, 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 technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.
[0194] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0195] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
Claims
1. A method for processing scene special effects, characterized in that: The method comprises: Determine a plurality of target scene units of a scene special effect to be processed in a virtual scene, and a special effect grid corresponding to the virtual scene, wherein the special effect grid includes a plurality of special effect units; Determine a target special effect unit corresponding to the target scene unit among the multiple special effect units, and target special effect information corresponding to the target special effect unit; the target special effect information is used to indicate a target display area of the scene special effect in the special effect unit; Obtaining a target special effect map corresponding to the target special effect information in a preset special effect map set; wherein the special effect map set includes different special effect maps corresponding to different target special effect information, and the special effect map is used to store stylized special effect textures; According to the target special effect map, a target special effect texture is added to the special effect model corresponding to the target special effect unit to render and generate the scene special effect with a target expression style in the virtual scene; the target expression style matches the style of the special effect texture stored in the target special effect map.
2. The method according to claim 1, characterized in that In the special effect grid, similarity of pixel values of the special effect maps corresponding to the target special effect information of adjacent special effect units on adjacent boundaries is greater than a preset similarity.
3. The method according to claim 1 or 2, characterized in that: One of the target scene units includes a plurality of scene vertices; and determining a target special effect unit corresponding to the target scene unit among the plurality of special effect units includes: For each of the target scene units, determining the scene vertex of the target scene unit; A special effect unit with the scene vertex as its geometric center is determined as a target special effect unit corresponding to the target scene unit among the multiple special effect units.
4. The method according to claim 1 or 2, characterized in that: One of the special effect units includes a plurality of special effect vertices, each of the special effect vertices corresponds to first special effect information; the first special effect information is used to indicate a first display state of the scene special effect in a unit area corresponding to the special effect vertex in the special effect unit; Determining target special effect information corresponding to the target special effect unit includes: Determine a first special effect vertex among the plurality of special effect vertices of the target special effect unit; The first special effect vertex is located inside the target scene unit corresponding to the target special effect unit; The first special effect information corresponding to the first special effect vertex is adjusted to second special effect information; the second special effect information is used to indicate a second display state of the scene special effect in the unit area corresponding to the first special effect vertex in the target special effect unit; Determine the second special effect information corresponding to the first special effect vertex and the first special effect information corresponding to the second special effect vertex as target special effect information corresponding to the target special effect unit; The second special effect vertex is located outside the target scene unit corresponding to the target special effect unit.
5. The method according to claim 4, characterized in that The step of adding a target special effect texture to a special effect model corresponding to the target special effect unit according to the target special effect map comprises: Determine a first texture coordinate of a special effect model corresponding to the target special effect unit; Sampling the target special effect map corresponding to the target special effect unit according to the first texture coordinates to obtain first texture information; Rendering is performed according to the first texture information to add the target special effect texture to the special effect model corresponding to the target special effect unit; the texture features of the target special effect texture are at least partially the same as the texture features of the special effect texture stored in the target special effect map.
6. The method according to claim 5, characterized in that The determining the first texture coordinate of the target special effect unit includes: The preset texture coordinates corresponding to the preset two-dimensional patch model are determined as the first texture coordinates of the special effect model corresponding to the target special effect unit; the two-dimensional patch model is the special effect model without special effect texture.
7. The method according to claim 5, characterized in that The rendering according to the first texture information to add the target special effect texture to the special effect model corresponding to the target special effect unit includes: Determine the second texture coordinates of the special effect model corresponding to the target special effect unit; the special effect models corresponding to different target special effect units have different second texture coordinates; Determine the special effect flow information corresponding to the target special effect unit according to the second texture coordinates and the flow field map corresponding to the scene special effect, wherein the flow field map is used to store the special effect flow information of the scene special effect; Rendering is performed according to the special effect flow information and the first texture information to add the target special effect texture with a flow effect to the special effect model corresponding to the target special effect unit.
8. The method according to claim 7, characterized in that The determining the second texture coordinates of the target special effect unit includes: Obtain the cell coordinates of the target special effect unit in the special effect grid; Acquire preset texture coordinates of a two-dimensional patch model corresponding to the special effect grid; the two-dimensional patch model is the special effect model without special effect texture; The second texture coordinates of the target special effect unit are determined according to the preset texture coordinates and the cell coordinates.
9. The method according to claim 7, characterized in that: The rendering according to the special effect flow information and the first texture information to add the target special effect texture with a flow effect to the special effect model corresponding to the target special effect unit includes: Controlling the first texture coordinate to shift according to the special effect flow information to obtain the first texture coordinate after shifting; Sampling the target special effect map corresponding to the target special effect unit according to the offset first texture coordinates to obtain the first texture information having the flow effect; Rendering is performed according to the first texture information having the flow effect, so as to add the target special effect texture having the flow effect to the special effect model corresponding to the target special effect unit.
10. The method according to claim 7, characterized in that The rendering according to the special effect flow information and the first texture information to add the target special effect texture with a flow effect to the special effect model corresponding to the target special effect unit includes: Controlling the second texture coordinates to shift according to the special effect flow information to obtain the shifted second texture coordinates; Sampling the basic color map corresponding to the scene special effect according to the offset second texture coordinates to obtain second texture information with a flow effect; the second texture information is used to indicate a target color of the second special effect texture; Rendering is performed according to the first texture information and the second texture information with the flow effect, so as to add the target special effect texture with the flow effect and the target color to the special effect model corresponding to the target special effect unit.
11. The method according to claim 1, characterized in that: The step of determining a special effect grid corresponding to the virtual scene comprises: Obtaining the vertex position and scene unit size of each scene unit corresponding to the virtual scene; The vertex position is used as the center position of the special effect unit to be generated, the scene unit size of the scene unit is used as the special effect unit size of the special effect unit to be generated, and a plurality of the special effect units are generated to obtain the special effect grid.
12. A scene special effect processing device, characterized in that: The device comprises: a determination unit, an acquisition unit and a generation unit; The determining unit is used to determine a plurality of target scene units of a scene special effect to be processed in a virtual scene, and a special effect grid corresponding to the virtual scene, the special effect grid including a plurality of special effect units, and the scene special effect presenting a first performance effect in the virtual scene; The determination unit is further used to determine a target special effect unit corresponding to the target scene unit among the multiple special effect units, and target special effect information corresponding to the target special effect unit; the target special effect information is used to indicate a target display area of the scene special effect in the special effect unit; The acquisition unit is further used to acquire a target special effect map corresponding to the target special effect information in a preset special effect map set; wherein the special effect map set includes different special effect maps corresponding to different target special effect information, and the special effect map is used to store stylized special effect textures; The generating unit is used to add a target special effect texture to the special effect model corresponding to the target special effect unit according to the target special effect map, so as to render and generate the scene special effect with a target expression style in the virtual scene; the target expression style matches the style of the special effect texture stored in the target special effect map.
13. An electronic device, characterized in that: include: processor; as well as The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method according to any one of claims 1 to 11 is executed.
14. A computer-readable storage medium, characterized in that: A data processing program is stored, and the program is run by a processor to execute the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Special effect processing method, device and equipment and storage medium
CN110354500A
Image processing method and device, electronic equipment and storage medium
CN115272145A
Special effect image drawing method and device, equipment and medium
CN115578495A
Special effect video production method and device, electronic equipment and readable storage medium
CN115801978A
Special effect generation method and device, computer equipment and storage medium
CN119152083A