Blasting effect rendering method and device, electronic equipment and storage medium

By creating a semi-transparent model with inward-facing normals in the game engine and performing 3D mapping, the problem of high rendering costs for vertical wall explosion effects was solved, achieving low-cost and realistic explosion effect rendering.

CN116510292BActive Publication Date: 2026-06-02NETEASE (HANGZHOU) NETWORK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2023-03-21
Publication Date
2026-06-02

Smart Images

  • Figure CN116510292B_ABST
    Figure CN116510292B_ABST
Patent Text Reader

Abstract

The application provides a blasting effect rendering method and device, electronic equipment and storage medium. The blasting effect rendering method comprises the following steps: forming a first model with a normal line inward in a world space of a game engine, and configuring a material of the first model as semi-transparent and closing a depth test; acquiring a second model located inside the first model; acquiring three position components of a vertex position of a vertex on the second model on three direction axes of a model space of the first model, forming a first vector corresponding to the vertex with the three position components; screening two position components from the three position components of the first vector as texture sampling coordinates corresponding to the vertex based on a normal direction of the vertex on the second model; acquiring a blasting map, and mapping the blasting map on the second model according to the normal direction of the vertex and the corresponding texture sampling coordinates, so as to obtain a blasting effect. The blasting effect rendering method provided in the application embodiment can reduce the rendering consumption of the blasting effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computers, and in particular to a method, apparatus, electronic device, and storage medium for rendering explosion effects. Background Technology

[0002] In games, explosion-related special effects are an indispensable part of creating a combat atmosphere, and the blasting effects left behind after the explosion (i.e., explosion damage effects) are also an important means of enhancing immersion.

[0003] Currently in games, the explosion effect left on the surface after an explosion is usually represented by a single explosion map (Decal) facing the ground. This method cannot produce an effect on vertical walls, so it may be necessary to copy six explosion maps and map them based on the six different directions of up, down, left, right, front, and back. Such an explosion effect rendering scheme will bring high rendering costs. Summary of the Invention

[0004] In view of this, the present invention provides a method, apparatus, electronic device and storage medium for rendering explosion effects, which can obtain explosion effects that are always facing the virtual camera while reducing the rendering cost of explosion effects.

[0005] In a first aspect, embodiments of the present invention provide a method for rendering explosion effects. The method includes: forming a first model with inwardly oriented normals in the world space of a game engine; configuring the material of the first model as semi-transparent and disabling depth testing; the direction axes of the model space of the first model and the direction axes of the world space are parallel and correspond one-to-one; obtaining a second model located within the first model, the second model being part of a scene model, the scene model being a model used to form a preset scene in the world space; obtaining three positional components of the vertex positions of vertices on the second model on three direction axes of the model space of the first model, and forming a first vector corresponding to the vertex with the three positional components; selecting two positional components from the three positional components of the first vector based on the normal direction of the vertex on the second model as texture sampling coordinates corresponding to the vertex; obtaining an explosion map; and mapping the explosion map onto the second model according to the normal direction of the vertex and the corresponding texture sampling coordinates to obtain an explosion effect.

[0006] According to the foregoing embodiments of the first aspect of the present invention, the first model is a cube model, and three faces of the first model are simultaneously located within the field of view of the virtual camera, wherein the three faces are adjacent to each other and orthogonal to each other in the cube model.

[0007] According to any of the foregoing embodiments of the first aspect of the present invention, the scene model includes a virtual ground and virtual walls.

[0008] According to any of the foregoing embodiments of the first aspect of the present invention, obtaining the three positional components of the vertex position of the second model on the three directional axes of the model space of the first model includes: obtaining a second vector pointing from the origin of the world space to the vertex on the second model based on the vertex position of the second model and the origin of the world space; and multiplying the directional vectors of the three directional axes of the model space of the first model by the second vector to obtain the corresponding three positional components.

[0009] According to any of the foregoing embodiments of the first aspect of the present invention, the three directional axes of the model space of the first model are a first directional axis, a second directional axis, and a third directional axis that are mutually orthogonal. The step of selecting two positional components from the three positional components of the first vector as texture sampling coordinates corresponding to the vertex based on the normal direction of the vertex on the second model includes: if the normal direction of the vertex is the same as the orientation of the first directional axis of the model space of the first model, then the positional components in the first vector corresponding to the second directional axis and the third directional axis are used as texture sampling coordinates corresponding to the vertex.

[0010] According to any of the foregoing embodiments of the first aspect of the present invention, mapping the explosion map onto the second model based on the normal direction of the vertex and the corresponding texture sampling coordinates comprises: obtaining a third vector based on the vertex position of the vertex on the second model and the model center of the first model, wherein the direction of the third vector points from the vertex to the model center, and the length value of the third vector is the distance between the vertex and the model center; and mapping the explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex.

[0011] According to any of the foregoing embodiments of the first aspect of the present invention, mapping the explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex includes: multiplying the normal of the vertex by the third vector corresponding to the vertex to obtain a dot product result; determining the vertex with a positive dot product result as the target vertex; and mapping the explosion map onto the second model based on the target vertex.

[0012] According to any of the foregoing embodiments of the first aspect of the present invention, mapping the explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex includes: performing a calculation on the length value of the third vector and a preset attenuation function to obtain an attenuation value corresponding to the vertex, wherein the attenuation function includes a mapping relationship between the length value of the third vector and the attenuation value; determining the transparency of the vertex when mapping the explosion map based on the attenuation value, wherein the transparency increases with the increase of the length value of the corresponding third vector.

[0013] According to any of the foregoing embodiments of the first aspect of the present invention, obtaining the explosion map includes: obtaining a four-dimensional continuous noise map.

[0014] According to any of the foregoing embodiments of the first aspect of the present invention, the step of mapping the explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex further includes: obtaining the texel corresponding to the vertex in the noise map; multiplying the chromaticity value of the texel corresponding to the vertex by the attenuation value and adding a first preset value to obtain a calculation result; mapping a first color onto the vertex based on the calculation result being greater than or equal to a second preset value; and mapping a second color onto the vertex based on the calculation result being less than the second preset value.

[0015] Secondly, embodiments of the present invention provide an explosion effect rendering device, comprising: a first model acquisition module, configured to form a first model with inwardly oriented normals in the world space of a game engine, configuring the material of the first model as semi-transparent and disabling depth testing, wherein the direction axes of the model space of the first model correspond one-to-one with the direction axes of the world space; a second model acquisition module, configured to acquire a second model located within the first model, wherein the second model is part of a scene model, and the scene model is a model used to form a preset scene in the world space; a first vector acquisition module, configured to acquire three positional components of the vertex position of a vertex on the second model on three direction axes of the model space of the first model, and forming a first vector corresponding to the vertex with the three positional components; a texture sampling coordinate acquisition module, configured to select two positional components from the three positional components of the first vector as texture sampling coordinates corresponding to the vertex based on the normal direction of the vertex on the second model; and a texture mapping module, configured to acquire an explosion texture, and map the explosion texture onto the second model according to the normal direction of the vertex and the corresponding texture sampling coordinates to obtain an explosion effect.

[0016] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the explosion effect rendering method according to any of the foregoing embodiments of the first aspect of the present invention.

[0017] Fourthly, embodiments of the present invention provide a machine-readable storage medium, characterized in that the machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the explosion effect rendering method according to any of the foregoing embodiments of the first aspect of the present invention.

[0018] According to the explosion effect rendering method, apparatus, electronic device, and storage medium of the present invention, a first model with inward normals is formed in the world space of the game engine. The material of the first model is configured to be semi-transparent and depth testing is turned off. This ensures that the explosion texture is not occluded or culled at any angle during subsequent explosion texture mapping, and that the explosion texture will affect the model space of the first model from any viewpoint. The direction axes of the model space of the first model are parallel to the direction axes of the world space. In this embodiment, the vertex positions of the vertices on the second model are obtained as three positional components on the three direction axes of the model space of the first model. The three positional components form a first vector corresponding to the vertex. Then, based on the normal direction of the vertex on the second model, two positional components are selected from the three positional components of the first vector as the texture sampling coordinates corresponding to the vertex. Then, according to the normal direction of the vertex and the corresponding texture sampling coordinates, the explosion texture is mapped on the second model, realizing the mapping of the three-dimensional explosion texture using a mesh of the first model. The first model has a face that always faces the virtual camera, thereby achieving three-dimensional mapping of the explosion texture with lower rendering cost and reducing the rendering cost of the explosion effect.

[0019] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0020] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0021] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0022] Figure 1 A flowchart of an explosion effect rendering method provided in one embodiment of the present invention;

[0023] Figure 2 The flowchart of the explosion effect rendering method provided in one embodiment of the present invention is as follows: based on the normal direction of the vertex and the corresponding texture sampling coordinates, an explosion map is mapped on the second model to obtain the explosion effect.

[0024] Figure 3 This is a structural block diagram of an explosion effect rendering device provided in one embodiment of the present invention;

[0025] Figure 4 This is a structural block diagram of an electronic device provided in one embodiment of the present invention. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0027] In games, explosion-related special effects are an indispensable part of creating a combat atmosphere, and the blasting effects left behind after the explosion (i.e., explosion damage effects) are also an important means of enhancing immersion.

[0028] Currently in games, the explosion effect left on the surface after an explosion is usually represented by a single explosion map (Decal) facing the ground. This method cannot produce an effect on vertical walls, so it may be necessary to copy six explosion maps and map them based on the six different directions of up, down, left, right, front, and back. Such an explosion effect rendering scheme will bring high rendering costs.

[0029] Based on this, the explosion effect rendering method, apparatus, electronic device and storage medium provided by the embodiments of the present invention can obtain an explosion effect that is always facing the virtual camera while reducing the rendering cost of the explosion effect.

[0030] In one embodiment of the present invention, the explosion effect rendering method can run on a local terminal device (touchscreen or non-touchscreen client device) or a server. When the explosion effect rendering method runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.

[0031] In some alternative implementations, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separated. The storage and execution of explosion effect rendering methods are completed on the cloud gaming server. The client device is used for data reception, transmission, and game screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, or PDA; however, the information processing is performed by the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses game screen data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.

[0032] In some alternative implementations, taking a game as an example, the local terminal device stores the game program and is used to display the game screen. The local terminal device is used to interact with the player through a graphical user interface (GUI), i.e., conventionally downloading, installing, and running the game program via an electronic device. The local terminal device can provide the GUI to the player in various ways, such as rendering it on the terminal's display screen or providing it to the player via holographic projection. For example, the local terminal device can include a display screen for displaying the GUI, which includes game screens, and a processor for running the game, generating the GUI, and controlling the display of the GUI on the display screen.

[0033] In one possible implementation, this invention provides a method for rendering explosion effects, which provides a graphical user interface (GUI) through a terminal device. The terminal device can be either a local terminal device or a client device in a cloud interaction system. This GUI provides content that can be displayed according to the type of application being launched, such as game scene visuals, communication interaction windows, etc.

[0034] To facilitate understanding of this embodiment, a detailed description of the explosion effect rendering method disclosed in this embodiment of the invention will be provided first. Figure 1This is a flowchart illustrating a method for rendering explosion effects according to an embodiment of the present invention. In this embodiment, the method for rendering explosion effects includes steps S110 to S140.

[0035] In step S110, a first model with inward normals is formed in the world space of the game engine. The material of the first model is configured to be semi-transparent and the depth test is turned off. The orientation axis of the model space of the first model corresponds to and is parallel to the orientation axis of the world space.

[0036] In game engines, faces with outward-facing normals are typically considered the outer surface (or front face) of the mesh, while faces with inward-facing normals are considered the inner surface (or back face). Game engines usually cull the inner surfaces. In this case, the normals of the first model are flipped inwards and outwards, causing the original outer surface to become the inner surface and be culled, leaving only the original inner surface. Within the virtual camera's field of view, the original inner surface remains. If the normals of the first model were not flipped inwards and outwards, the explosion texture effect would not exist within the virtual camera's field of view due to the culling of the original inner surface.

[0037] Configure the material of the first model to be semi-transparent and disable depth testing to ensure that the explosion texture is not occluded or culled from any angle. This ensures that the explosion texture will affect the model space of the first model from all viewpoints.

[0038] In some embodiments, the first model is a cube model, and three faces of the first model are simultaneously located within the field of view of the virtual camera. The three faces are adjacent to each other and orthogonal to each other within the cube model. When the first model is a cube model, it is convenient to ensure the integrity of the explosion texture during subsequent explosion texture mapping.

[0039] In step S120, a second model located within the first model is obtained. The second model is part of the scene model, which is a model used to form a preset scene in the world space.

[0040] In some embodiments, the scene model includes a virtual ground and virtual walls. In some embodiments, the scene model may also include a virtual character that can move around on the virtual ground.

[0041] In step S130, the vertex position of the second model is obtained in three positional components on the three directional axes of the model space of the first model, and the three positional components form the first vector corresponding to the vertex.

[0042] In some embodiments, the step S130 of obtaining the three positional components of the vertex position of the second model on the three directional axes of the model space of the first model includes: obtaining a second vector pointing from the origin of the world space to the vertex of the second model based on the vertex position of the second model and the origin of the world space; and multiplying the directional vectors of the three directional axes of the model space of the first model by the second vector to obtain the corresponding three positional components.

[0043] In step S140, based on the normal direction of the vertex on the second model, two positional components are selected from the three positional components of the first vector as the texture sampling coordinates corresponding to the vertex.

[0044] In some embodiments, the three directional axes of the model space of the first model are a first directional axis, a second directional axis, and a third directional axis that are orthogonal to each other. The step S140 of selecting two positional components from the three positional components of the first vector as the texture sampling coordinates corresponding to the vertex based on the normal direction of the vertex on the second model includes: if the normal direction of the vertex is the same as the orientation of the first directional axis of the model space of the first model, then the positional components in the first vector that correspond to the second directional axis and the third directional axis are used as the texture sampling coordinates corresponding to the vertex.

[0045] The three orientation axes of the model space of the first model are the X-axis, Y-axis, and Z-axis. If the normal direction of a vertex is the same as the X-axis orientation of the model space of the first model, then the positional components of the first vector corresponding to the Y-axis and Z-axis are used as the texture sampling coordinates of the vertex. If the normal direction of a vertex is the same as the Y-axis orientation of the model space of the first model, then the positional components of the first vector corresponding to the X-axis and Z-axis are used as the texture sampling coordinates of the vertex. If the normal direction of a vertex is the same as the Z-axis orientation of the model space of the first model, then the positional components of the first vector corresponding to the X-axis and Y-axis are used as the texture sampling coordinates of the vertex.

[0046] In step S150, an explosion map is obtained. Based on the normal direction of the vertex and the corresponding texture sampling coordinates, the explosion map is mapped onto the second model to obtain the explosion effect.

[0047] Figure 2 The flowchart of the explosion effect rendering method provided in one embodiment of the present invention is as follows: mapping an explosion map onto a second model based on the normal direction of the vertex and the corresponding texture sampling coordinates to obtain the explosion effect. In this embodiment, mapping an explosion map onto a second model based on the normal direction of the vertex and the corresponding texture sampling coordinates to obtain the explosion effect includes steps S151 and S152.

[0048] In step S151, a third vector is obtained based on the vertex positions of the vertices in the second model and the model center of the first model. The direction of the third vector points from the vertex to the model center, and the length of the third vector is the distance between the vertex and the model center. The model center of the first model serves as the virtual explosion center for the explosion effect.

[0049] In step S152, a burst map is mapped onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex.

[0050] In some embodiments, step S152, which maps an explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex, includes: multiplying the normal of the vertex by the third vector corresponding to the vertex to obtain a dot product; identifying vertices with a positive dot product as target vertices; and mapping an explosion map onto the second model based on the target vertices. In the above embodiments, multiplying the normal of the vertex by the third vector corresponding to the vertex to obtain a dot product result reflects the degree to which the normal of the vertex faces the virtual explosion center. The face containing the vertex with a positive dot product result is the face facing the virtual explosion center, and the explosion map will be mapped onto this face. The face containing the vertex with a negative dot product result is the face away from the virtual explosion center, and the explosion map will not be mapped onto this face.

[0051] In some embodiments, step S152 of mapping a burst map onto the second model based on a third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex includes: calculating the length value of the third vector with a preset attenuation function to obtain an attenuation value corresponding to the vertex, wherein the attenuation function includes the mapping relationship between the length value of the third vector and the attenuation value; and determining the transparency of the vertex when mapping the burst map based on the attenuation value, wherein the transparency increases as the length value of the corresponding third vector increases. In the above embodiments, the attenuation function is, for example, a monotonic function.

[0052] In some embodiments, obtaining the explosion map includes obtaining a four-dimensional continuous noise map. Using a four-dimensional continuous noise map to form the explosion map can avoid discontinuities at the intersections of different surfaces, thus improving the rendering visual effect of the explosion.

[0053] In some embodiments, mapping the explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex further includes: obtaining the texels corresponding to the vertex in the noise map; multiplying the chromaticity value of the texel corresponding to the vertex by the attenuation value and adding a first preset value to obtain a calculation result; mapping a first color onto the vertex based on the calculation result being greater than or equal to a second preset value; and mapping a second color onto the vertex based on the calculation result being less than the second preset value. The first color is, for example, red, to simulate the high-temperature trace at the center of the explosion effect, and the second color is, for example, black, to simulate the outer fragmentation trace of the explosion effect.

[0054] The first preset value can be set according to actual needs. By adjusting the first preset value, the ratio of the simulated central high-temperature trace to the peripheral fracture trace can be adjusted. For example, the second preset value is 1. When the result of multiplying the chromaticity value of the vertex corresponding to the vertex by the attenuation value and adding the first preset value is greater than or equal to 1, the first color is mapped to that vertex; when the result of multiplying the chromaticity value of the vertex corresponding to the vertex by the attenuation value and adding the first preset value is less than 1, the second color is mapped to that vertex. This allows for layered simulation of the central high-temperature trace and the peripheral fracture trace of the explosion effect, improving the realism of the explosion effect simulation rendering.

[0055] According to the explosion effect rendering method of the present invention, a first model with inward normals is formed in the world space of the game engine. The material of the first model is configured to be semi-transparent and depth testing is turned off. This ensures that the explosion texture will not be occluded or culled from any angle when mapping the explosion texture in the subsequent process. It can also ensure that the explosion texture will be affected within the model space of the first model from any viewpoint. The direction axis of the model space of the first model is parallel to the direction axis of the world space. In this embodiment of the invention, the vertex position of the second model is obtained as three positional components on the three direction axes of the first model's model space. The three positional components form a first vector corresponding to the vertex. Then, based on the normal direction of the vertex on the second model, two positional components are selected from the three positional components of the first vector as the texture sampling coordinates corresponding to the vertex. Then, according to the normal direction of the vertex and the corresponding texture sampling coordinates, the explosion texture is mapped on the second model. This achieves the mapping of a three-way explosion texture using a mesh of the first model. The first model has a face that always faces the virtual camera, thereby achieving the three-dimensional mapping of the explosion texture with lower rendering cost and reducing the rendering cost of the explosion effect.

[0056] In the explosion effect rendering method of this embodiment, the second model is rendered in a three-dimensional spherical attenuation pattern radiating outward from the center of the first model, and the high-temperature traces at the center of the explosion and the surrounding fragmentation traces are simulated and rendered in layers, so as to more realistically restore the real explosion traces, making the explosion effect rendering result have a more realistic appearance and improving the rendering visual effect.

[0057] This invention also provides an explosion effect rendering device. Figure 3 This is a structural block diagram of an explosion effect rendering device according to an embodiment of the present invention. The explosion effect rendering device includes a first model acquisition module 110, a second model acquisition module 120, a first vector acquisition module 130, a texture sampling coordinate acquisition module 140, and a texture mapping module 150.

[0058] The first model acquisition module 110 is used to form a first model with inward normals in the world space of the game engine, configure the material of the first model to be semi-transparent and turn off depth testing, and the orientation axis of the model space of the first model corresponds to and is parallel to the orientation axis of the world space.

[0059] The second model acquisition module 120 is used to acquire a second model located within the first model. The second model is part of the scene model, which is a model used to form a preset scene in the world space.

[0060] The first vector acquisition module 130 is used to acquire the vertex position of the vertex on the second model and the three position components on the three direction axes of the model space of the first model, and to form the first vector corresponding to the vertex with the three position components.

[0061] The texture sampling coordinate acquisition module 140 is used to select two positional components from the three positional components of the first vector as the texture sampling coordinates corresponding to the vertex based on the normal direction of the vertex on the second model.

[0062] The texture mapping module 150 is used to obtain explosion textures. Based on the normal direction of the vertices and the corresponding texture sampling coordinates, the explosion texture is mapped onto the second model to obtain the explosion effect.

[0063] According to the explosion effect rendering apparatus of the present invention, the first model acquisition module 110 forms a first model with inward normals in the world space of the game engine, configures the material of the first model as semi-transparent and disables depth testing, so that when mapping explosion maps in the future, the explosion maps will not be occluded or culled at any angle, and the explosion maps will be affected within the model space of the first model at any viewpoint. The orientation axes of the model space of the first model are parallel to the orientation axes of the world space. In this embodiment of the invention, the first vector acquisition module 130 is used to acquire the three positional components of the vertex position of the second model on the three orientation axes of the first model. The three positional components form the first vector corresponding to the vertex. Then, the texture sampling coordinate acquisition module selects two positional components from the three positional components of the first vector based on the normal direction of the vertex on the second model as the texture sampling coordinates corresponding to the vertex. Then, the texture mapping module 150 maps the explosion map on the second model according to the normal direction of the vertex and the corresponding texture sampling coordinates, so as to realize the mapping of the three-way explosion map with a mesh of the first model. The first model has a face that faces the virtual camera at all times, so as to realize the three-dimensional mapping of the explosion map with low rendering cost and reduce the rendering cost of the explosion effect.

[0064] In some embodiments, the first model is a cube model, and three faces of the first model are simultaneously located within the field of view of the virtual camera. The three faces are adjacent to each other and orthogonal to each other in the cube model.

[0065] In some embodiments, the scene model includes virtual ground and virtual walls.

[0066] In some embodiments, the first vector acquisition module 130 is configured to: acquire a second vector pointing from the origin of the world space to the vertex on the second model based on the vertex position on the second model and the origin of the world space; and multiply the direction vectors of the three direction axes of the model space of the first model by the second vector to obtain the corresponding three position components.

[0067] In some embodiments, the three directional axes of the model space of the first model are a first directional axis, a second directional axis, and a third directional axis that are orthogonal to each other. The texture sampling coordinate acquisition module 140 is configured to: if the normal direction of the vertex is the same as the orientation of the first directional axis of the model space of the first model, then the position components in the first vector corresponding to the second directional axis and the third directional axis are used as the texture sampling coordinates of the vertex.

[0068] In some embodiments, the texture mapping module 150 includes a third vector acquisition unit and a mapping unit.

[0069] The third vector acquisition unit is used to acquire a third vector based on the vertex position of the vertex in the second model and the model center of the first model. The direction of the third vector is from the vertex to the model center, and the length of the third vector is the distance between the vertex and the model center.

[0070] The mapping unit is used to map explosion maps onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex.

[0071] In some embodiments, the mapping unit is configured to: multiply the normal of a vertex by the third vector corresponding to the vertex to obtain the dot product result; determine the vertex whose dot product result is positive as the target vertex; and map an explosion map on the second model based on the target vertex.

[0072] In some embodiments, the mapping unit is configured to: perform a calculation on the length value of the third vector and a preset decay function to obtain a decay value corresponding to the vertex, wherein the decay function includes a mapping relationship between the length value of the third vector and the decay value; and determine the transparency of the vertex when mapping the explosion map based on the decay value, wherein the transparency increases with the increase of the length value of the corresponding third vector.

[0073] In some embodiments, obtaining the explosion map includes obtaining a four-dimensional continuous noise map.

[0074] In some embodiments, the mapping unit is configured to: obtain the texel corresponding to the vertex in the noise map; multiply the chromaticity value of the texel corresponding to the vertex by the attenuation value and add a first preset value to obtain a calculation result; map a first color to the vertex based on the calculation result being greater than or equal to a second preset value; and map a second color to the vertex based on the calculation result being less than the second preset value.

[0075] The explosion effect rendering device according to the above embodiment can perform three-dimensional spherical attenuation rendering of the second model radiating outward from the center of the first model, and simulate the high temperature traces at the center of the explosion and the surrounding fragmentation traces in layers, thereby more realistically restoring the real explosion traces, making the explosion effect rendering result have a more realistic explosion appearance and improving the rendering visual effect.

[0076] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described explosion effect rendering method. This electronic device can be a server or a terminal device.

[0077] Figure 4The present invention provides a structural block diagram of an electronic device, which includes a processor 901 and a memory 902. The memory 902 stores machine-executable instructions that can be executed by the processor 901. The processor 901 executes the machine-executable instructions to implement the above-mentioned explosion effect rendering method.

[0078] The explosion effect rendering method includes: forming a first model with inward-facing normals in the world space of the game engine; configuring the material of the first model as semi-transparent and disabling depth testing; ensuring that the direction axes of the model space of the first model correspond one-to-one with the direction axes of the world space; obtaining a second model located within the first model, which is part of the scene model used to form a preset scene in the world space; obtaining the three positional components of the vertex positions on the second model on the three direction axes of the first model's model space, and forming a first vector corresponding to the vertex with the three positional components; selecting two positional components from the three positional components of the first vector based on the normal direction of the vertex on the second model as the texture sampling coordinates corresponding to the vertex; obtaining the explosion map, and mapping the explosion map onto the second model according to the normal direction of the vertex and the corresponding texture sampling coordinates to obtain the explosion effect.

[0079] Furthermore, the electronic device may also include a communication interface 903 and a bus 904, with the processor 901, communication interface 903 and memory 902 connected via the bus 904.

[0080] The memory 902 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 903 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 904 may be an ISA bus, PCI bus, or EISA bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, a bus is represented by only a single bidirectional arrow in the accompanying drawings, but this does not imply that there is only one bus or one type of bus.

[0081] The processor 901 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 901 or by instructions in software form. The processor 901 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 902. Processor 901 reads information from memory 902 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0082] In some embodiments, the first model is a cube model, and three faces of the first model are simultaneously located within the field of view of the virtual camera. The three faces are adjacent to each other and orthogonal to each other in the cube model.

[0083] In some embodiments, the scene model includes virtual ground and virtual walls.

[0084] In some embodiments, obtaining the three positional components of the vertex position of the second vertex on the three directional axes of the model space of the first model includes: obtaining a second vector pointing from the origin of the world space to the vertex on the second model based on the vertex position of the second vertex and the origin of the world space; and multiplying the directional vectors of the three directional axes of the model space of the first model by the second vector to obtain the corresponding three positional components.

[0085] In some embodiments, the three directional axes of the model space of the first model are a first directional axis, a second directional axis, and a third directional axis that are orthogonal to each other. Based on the normal direction of the vertex on the second model, selecting two positional components from the three positional components of the first vector as the texture sampling coordinates corresponding to the vertex includes: if the normal direction of the vertex is the same as the orientation of the first directional axis of the model space of the first model, then the positional components in the first vector that correspond to the second directional axis and the third directional axis are used as the texture sampling coordinates corresponding to the vertex.

[0086] In some embodiments, mapping a burst map onto the second model based on the normal direction of the vertex and the corresponding texture sampling coordinates includes:

[0087] In some embodiments, a third vector is obtained, the direction of which points from the vertex to the center of the model, and the length of which is the distance between the vertex and the center of the model. Based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex, an explosion map is mapped onto the second model.

[0088] In some embodiments, mapping an explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex includes: multiplying the normal of the vertex by the third vector corresponding to the vertex to obtain the dot product result; determining the vertex with a positive dot product result as the target vertex; and mapping the explosion map onto the second model based on the target vertex.

[0089] In some embodiments, mapping a burst map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex includes: performing a calculation on the length value of the third vector and a preset decay function to obtain a decay value corresponding to the vertex, wherein the decay function includes the mapping relationship between the length value of the third vector and the decay value; and determining the transparency when mapping the burst map to the vertex based on the decay value, wherein the transparency increases with the increase of the length value of the corresponding third vector.

[0090] In some embodiments, obtaining the explosion map includes obtaining a four-dimensional continuous noise map.

[0091] In some embodiments, mapping the explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex further includes: obtaining the texel corresponding to the vertex in the noise map, multiplying the chromaticity value of the texel corresponding to the vertex by the attenuation value and adding a first preset value to obtain the calculation result; mapping a first color onto the vertex based on the calculation result being greater than or equal to a second preset value; and mapping a second color onto the vertex based on the calculation result being less than the second preset value.

[0092] This embodiment also provides a machine-readable storage medium that stores machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the above-described explosion effect rendering method.

[0093] The explosion effect rendering method includes: forming a first model with inward-facing normals in the world space of the game engine; configuring the material of the first model as semi-transparent and disabling depth testing; ensuring that the direction axes of the model space of the first model correspond one-to-one with the direction axes of the world space; obtaining a second model located within the first model, which is part of the scene model used to form a preset scene in the world space; obtaining the three positional components of the vertex positions on the second model on the three direction axes of the first model's model space, and forming a first vector corresponding to the vertex with the three positional components; selecting two positional components from the three positional components of the first vector based on the normal direction of the vertex on the second model as the texture sampling coordinates corresponding to the vertex; obtaining the explosion map, and mapping the explosion map onto the second model according to the normal direction of the vertex and the corresponding texture sampling coordinates to obtain the explosion effect.

[0094] In some embodiments, the first model is a cube model, and three faces of the first model are simultaneously located within the field of view of the virtual camera. The three faces are adjacent to each other and orthogonal to each other in the cube model.

[0095] In some embodiments, the scene model includes virtual ground and virtual walls.

[0096] In some embodiments, obtaining the three positional components of the vertex position of the second vertex on the three directional axes of the model space of the first model includes: obtaining a second vector pointing from the origin of the world space to the vertex on the second model based on the vertex position of the second vertex and the origin of the world space; and multiplying the directional vectors of the three directional axes of the model space of the first model by the second vector to obtain the corresponding three positional components.

[0097] In some embodiments, the three directional axes of the model space of the first model are a first directional axis, a second directional axis, and a third directional axis that are orthogonal to each other. Based on the normal direction of the vertex on the second model, selecting two positional components from the three positional components of the first vector as the texture sampling coordinates corresponding to the vertex includes: if the normal direction of the vertex is the same as the orientation of the first directional axis of the model space of the first model, then the positional components in the first vector that correspond to the second directional axis and the third directional axis are used as the texture sampling coordinates corresponding to the vertex.

[0098] In some embodiments, mapping a burst map onto the second model based on the normal direction of the vertex and the corresponding texture sampling coordinates includes:

[0099] In some embodiments, a third vector is obtained, the direction of which points from the vertex to the center of the model, and the length of which is the distance between the vertex and the center of the model. Based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex, an explosion map is mapped onto the second model.

[0100] In some embodiments, mapping an explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex includes: multiplying the normal of the vertex by the third vector corresponding to the vertex to obtain the dot product result; determining the vertex with a positive dot product result as the target vertex; and mapping the explosion map onto the second model based on the target vertex.

[0101] In some embodiments, mapping a burst map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex includes: performing a calculation on the length value of the third vector and a preset decay function to obtain a decay value corresponding to the vertex, wherein the decay function includes the mapping relationship between the length value of the third vector and the decay value; and determining the transparency when mapping the burst map to the vertex based on the decay value, wherein the transparency increases with the increase of the length value of the corresponding third vector.

[0102] In some embodiments, obtaining the explosion map includes obtaining a four-dimensional continuous noise map.

[0103] In some embodiments, mapping the explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex further includes: obtaining the texel corresponding to the vertex in the noise map, multiplying the chromaticity value of the texel corresponding to the vertex by the attenuation value and adding a first preset value to obtain the calculation result; mapping a first color onto the vertex based on the calculation result being greater than or equal to a second preset value; and mapping a second color onto the vertex based on the calculation result being less than the second preset value.

[0104] The computer program products of the explosion effect rendering method, apparatus, electronic device and storage medium provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0105] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0106] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0107] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0108] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0109] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for rendering explosion effects, characterized in that, include: In the world space of the game engine, a first model with inward normals is formed. The material of the first model is configured to be semi-transparent and depth testing is turned off. The orientation axis of the model space of the first model corresponds to and is parallel to the orientation axis of the world space. Obtain a second model located within the first model, the second model being part of a scene model, the scene model being a model used to form a preset scene in the world space; Obtain the three positional components of the vertex position of the second model on the three directional axes of the model space of the first model, and form the first vector corresponding to the vertex with the three positional components; wherein, each of the three directional axes is orthogonal to the other. Based on the normal direction of the vertex in the second model, two positional components are selected from the three positional components of the first vector as the texture sampling coordinates corresponding to the vertex; wherein, the two selected positional components are the positional components corresponding to the two direction axes that are not in the same direction as the normal direction of the vertex in the second model among the three direction axes. Obtain the explosion map, and map the explosion map onto the second model according to the normal direction of the vertex and the corresponding texture sampling coordinates to obtain the explosion effect.

2. The explosion effect rendering method according to claim 1, characterized in that, The first model is a cube model, and three faces of the first model are simultaneously located within the field of view of the virtual camera. The three faces are adjacent to each other and orthogonal to each other in the cube model.

3. The explosion effect rendering method according to claim 1, characterized in that, The scene model includes virtual ground and virtual walls.

4. The explosion effect rendering method according to claim 1, characterized in that, The step of obtaining the three position components of the vertex position of the second model on the three orientation axes of the model space of the first model includes: Based on the vertex positions of the vertices in the second model and the origin of the world space, obtain a second vector pointing from the origin of the world space to the vertices in the second model; The direction vectors of the three directional axes of the model space of the first model are multiplied by the second vector to obtain the corresponding three position components.

5. The explosion effect rendering method according to claim 1, characterized in that, The three orientation axes of the model space of the first model are mutually orthogonal: a first orientation axis, a second orientation axis, and a third orientation axis. The step of selecting two positional components from the three positional components of the first vector as the texture sampling coordinates corresponding to the vertex, based on the normal direction of the vertex in the second model, includes: If the normal direction of the vertex is the same as the orientation of the first direction axis in the model space of the first model, then the position component in the first vector corresponding to the second direction axis and the third direction axis is used as the texture sampling coordinates corresponding to the vertex.

6. The explosion effect rendering method according to claim 1, characterized in that, The step of mapping the explosion map onto the second model based on the normal direction of the vertex and the corresponding texture sampling coordinates includes: Based on the vertex position of the second model and the model center of the first model, a third vector is obtained. The direction of the third vector is from the vertex to the model center, and the length of the third vector is the distance between the vertex and the model center. The explosion map is mapped onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex.

7. The explosion effect rendering method according to claim 6, characterized in that, The step of mapping the explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex includes: The dot product is obtained by multiplying the normal of the vertex with the third vector corresponding to the vertex. The vertex whose dot product result is positive is identified as the target vertex; The explosion map is mapped onto the second model based on the target vertex.

8. The explosion effect rendering method according to claim 6, characterized in that, The step of mapping the explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex includes: The length value of the third vector is calculated with a preset decay function to obtain the decay value corresponding to the vertex. The decay function includes the mapping relationship between the length value of the third vector and the decay value. The transparency of the vertex when mapping the explosion map is determined based on the attenuation value, wherein the transparency increases with the increase of the length value of the corresponding third vector.

9. The explosion effect rendering method according to claim 8, characterized in that, The acquisition of the explosion texture includes: Obtain a continuous noise map in all four directions.

10. The explosion effect rendering method according to claim 9, characterized in that, The step of mapping the explosion map onto the second model based on the third vector, the normal direction of the vertex, and the texture sampling coordinates corresponding to the vertex further includes: Obtain the texel corresponding to the vertex in the noise map, multiply the chromaticity value of the texel corresponding to the vertex by the attenuation value, and add a first preset value to obtain the calculation result; Based on the calculation result being greater than or equal to a second preset value, the first color is mapped onto the vertex; Based on the fact that the calculation result is less than the second preset value, the second color is mapped to the vertex.

11. A device for rendering explosion effects, characterized in that, include: The first model acquisition module is used to form a first model with inward normals in the world space of the game engine, configure the material of the first model to be semi-transparent and turn off depth testing, and the orientation axis of the model space of the first model corresponds one-to-one with the orientation axis of the world space. The second model acquisition module is used to acquire a second model located within the first model. The second model is part of the scene model, which is a model used to form a preset scene in the world space. The first vector acquisition module is used to acquire the three positional components of the vertex position of the vertex on the second model on the three directional axes of the model space of the first model, and to form the first vector corresponding to the vertex with the three positional components; wherein, each of the three directional axes is orthogonal to the other. The texture sampling coordinate acquisition module is used to select two position components from the three position components of the first vector as the texture sampling coordinates corresponding to the vertex based on the normal direction of the vertex on the second model; wherein, the two selected position components are the position components corresponding to the two direction axes that are not oriented in the same direction as the normal direction of the vertex on the second model among the three direction axes. The texture mapping module is used to obtain the explosion texture and map the explosion texture onto the second model according to the normal direction of the vertex and the corresponding texture sampling coordinates to obtain the explosion effect.

12. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the explosion effect rendering method according to any one of claims 1-10.

13. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the explosion effect rendering method according to any one of claims 1-10.