Collision effect rendering method and device, equipment, medium and program product
By obtaining and processing information of collision objects and hit objects in collision events, and calculating and rendering collision distance information on target collision surfaces, the problem of large-scale video memory overhead in decal texture technology is solved, and more efficient Performance and resource utilization.
Patent Information
- Application Number
- CN202411483678.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-07
AI Technical Summary
When the prior art is used on a large scale, decal texture technology leads to large overhead of video memory, which may lead to performance bottlenecks and waste of resources.
By obtaining the collision object and the impacted object in the collision event, determining the collision parameters, calculating the collision distance information on the target collision surface, and rendering the collision effect based on this information, avoiding comprehensive rendering of all faces of the impacted object.
Reduces video memory pressure, reduces the demand for storage space, and improves the overall performance and efficiency of the system.
Smart Images

Figure CN119399345A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of image rendering technology, and in particular to a collision effect rendering method, device, equipment, medium and program product. Background Art
[0002] In virtual scenes or videos, real special effects are crucial to improving user experience and immersion. With the development of graphics technology, image developers pay more and more attention to details and visual performance. Special effects (such as battle damage, explosions, smoke, etc.) have become a key link in enhancing image quality and user experience, involving texture mapping, physical calculations and other aspects.
[0003] In related technologies, special effects are mainly achieved through decal textures. Decal texture technology dynamically superimposes effects on the surface of models by creating special textures for objects. This method is suitable for minor effects and has low performance requirements. However, decal textures have a large memory overhead when used on a large scale, which may lead to performance bottlenecks and resource waste. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a collision effect rendering method. One or more embodiments of the present invention also relate to a collision effect rendering device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of the present invention, a collision effect rendering method is provided, comprising: Obtain the collision object that collides in the collision event and the collided object corresponding to the collision object, and determine the collision parameters of the collision event; Determine a collision path of the collision object according to the collision parameters, and determine a target collision surface and a collision position on the target collision surface from a plurality of to-be-collided surfaces of the collided object based on the collision path; Calculate the collision distance information between the initial position and the collision position in the target collision surface; Based on the collision distance information and collision parameters, the collision effect is rendered on the target collision surface.
[0006] According to a second aspect of an embodiment of the present invention, a collision effect rendering device is provided, comprising: An acquisition module is configured to acquire a collision object that collides in a collision event and a collision object corresponding to the collision object, and determine a collision parameter of the collision event; A determination module is configured to determine a collision path of the collision object according to the collision parameters, and based on the collision path, determine a target collision surface and a collision position on the target collision surface from a plurality of to-be-collided surfaces of the collided object; A calculation module is configured to calculate collision distance information between an initial position and a collision position in a target collision surface; The rendering module is configured to render a collision effect on a target collision surface based on the collision distance information and the collision parameters.
[0007] According to a third aspect of an embodiment of the present invention, there is provided a computing device, including: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned collision effect rendering method are implemented.
[0008] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the above-mentioned collision effect rendering method are implemented.
[0009] According to a fifth aspect of an embodiment of the present invention, a computer program product is provided, including a computer program / instruction, which implements the steps of the above-mentioned collision effect rendering method when executed by a processor.
[0010] An embodiment of the present invention realizes obtaining a collision object that collides in a collision event, and a collided object corresponding to the collision object, and determining collision parameters of the collision event; determining a collision path of the collision object according to the collision parameters, and based on the collision path, determining a target collision surface and a collision position on the target collision surface from multiple surfaces to be collided of the collided object; calculating collision distance information between an initial position and a collision position in the target collision surface; rendering a collision effect on the target collision surface based on the collision distance information and the collision parameters. This scheme calculates the collision distance information of the target collision surface through the collision path of the collision object and the collided object obtained in the collision event, and then renders the collision effect through the collision distance information and the collision parameters. Therefore, there is no need to render the collision effect on all surfaces of the collided object, thereby reducing the pressure on the video memory. At the same time, compared with pre-storing decal textures, the collision distance information will take up less storage space. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is a structural interaction diagram of a collision effect rendering system provided by an embodiment of the present invention; Figure 2 is a flow chart of a collision effect rendering method provided by an embodiment of the present invention; Figure 3 is a schematic diagram of a collision effect provided by an embodiment of the present invention; Figure 4 is a processing flow chart of a collision effect rendering method provided by an embodiment of the present invention; Figure 5 is a schematic diagram of a distance field map provided by an embodiment of the present invention; Figure 6 is another schematic diagram of collision effect provided by an embodiment of the present invention; Figure 7 is a structural schematic diagram of a collision effect rendering device provided by an embodiment of the present invention; Figure 8 It is a structural block diagram of a computing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0012] Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention 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 invention, so the present invention is not limited to the specific implementation disclosed below.
[0013] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms of "a", "said" and "the" used in one or more embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more associated listed items.
[0014] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present invention, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0015] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0016] First, the terms involved in one or more embodiments of the present invention are explained.
[0017] Decal Texture: Create a dedicated decal texture for the skinned object, draw the damage effect on the texture, and dynamically overlay them on the model surface when the game is running. This method is suitable for minor damage effects, has low performance requirements, has severe low-resolution aliasing, and has a large overhead for large-scale use of video memory.
[0018] GPU: Graphics processing unit, also known as display core, visual processor, display chip, is a microprocessor that specializes in image and graphics related computing on personal computers, workstations, game consoles and some mobile devices (such as tablets, smart phones, etc.).
[0019] Capsule: A capsule collider component is set for a 3D model or object in the game engine. The purpose of this is to allow this object to interact correctly with other objects in the virtual environment, such as responding to collision events, physical behaviors, etc.
[0020] Triangle: The basic geometric unit used in 3D graphics to represent the surface of a 3D model. A triangle is a planar polygon consisting of three vertices, which define a triangle. In 3D modeling and computer graphics, complex 3D models are usually composed of many triangles, which together constitute the surface of the model.
[0021] Bounding box: For each triangular face, we calculate a cube that encloses the triangle. This is done to simplify collision detection, because detecting collisions between cubes is much simpler than detecting collisions between triangles. For example: think of the path of a bullet as a cylinder. The path of a bullet can be defined as a straight line segment from the launch point to the expected end point, and the radius of the cylinder depends on the size of the bullet or the required collision accuracy. Then, check whether this cylinder intersects with the bounding box in the scene to determine whether the bullet hits the triangular face.
[0022] In virtual scenes or video games, real special effects are crucial to improving user experience and immersion. With the continuous advancement of graphics technology, image developers pay more and more attention to details and visual performance. Special effects (such as battle damage, explosions, smoke, etc.) have become a key link in enhancing picture quality and user experience. These effects not only involve texture mapping, but also involve physical calculations, lighting models and other aspects.
[0023] Decal texture technology is a common method for implementing special effects. Decal texture technology adds visual details to objects by dynamically superimposing effect textures on the surface of 3D models. For example, in games, battle damage effects can dynamically superimpose textures such as scratches, damage, or dirt on the surface of characters or vehicles through decal texture technology to simulate the wear and tear effects in battle. This technology allows developers to add details to models without having to modify the geometry of the model itself.
[0024] Smoke effects also often use decal texture technology. Developers can overlay a texture with a gradient of transparency into the scene to simulate the effect of smoke or haze. This method makes the smoke look more natural and can dynamically change its appearance over time or as the environment changes. Explosion effects can also be achieved through decal textures. The flames and smoke of the explosion can be generated quickly in the scene and dynamically change as the explosion lasts and decays.
[0025] Although decal texture technology performs well in small-scale applications, providing high visual quality and low performance overhead, it may cause increased video memory overhead and affect system performance when used on a large scale. Especially in complex scenes or games that require a lot of dynamic effects, the video memory requirements of decal texture technology may increase rapidly, leading to performance bottlenecks and resource waste. For example, when multiple objects with decal textures need to be displayed in the scene at the same time, the texture data of each object will occupy video memory, which may cause insufficient video memory or a drop in frame rate.
[0026] In response to the above problems, the present invention provides a collision effect rendering method. The present invention also relates to a collision effect rendering system, a collision effect rendering device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0027] See also Figure 1 , Figure 1It is a structural interaction diagram of a collision effect rendering system provided by an embodiment of the present invention, and the collision effect rendering system includes a detection end, a server end and a rendering end. The detection end is used to detect a collision event, and after detecting the occurrence of a collision event, obtains the collision object that collides in the collision event, and the collided object corresponding to the collision object, and determines the collision parameters of the collision event, and sends the collision object, the collided object and the collision parameters to the server end; the server end is used to determine the collision path of the collision object according to the collision parameters, and based on the collision path, determines the target collision surface and the collision position on the target collision surface from multiple surfaces to be collided by the collided object, calculates the collision distance information between the initial position and the collision position in the target collision surface, and sends the collision distance information to the rendering end; the rendering end is used to render the collision effect on the target collision surface based on the collision distance information and the collision parameters.
[0028] Applied to the collision rendering system, first, the detection end identifies the collision object and the object being collided when a collision event occurs, and obtains the collision parameters, which are sent to the server. The server determines the collision path based on the collision parameters, filters out the target collision surface, and calculates the collision distance information between the collision position and the initial position on the target collision surface. Finally, this distance information is sent to the rendering end, which renders the collision effect on the target collision surface based on the collision distance information and collision parameters. This method avoids the full rendering of all surfaces of the collided object, and only renders the collision effect on the target surface, which significantly reduces the pressure on the video memory. At the same time, the storage space occupied by the collision distance information is far less than the pre-stored decal texture, thereby improving the overall performance and efficiency of the system.
[0029] See also Figure 2 , Figure 2 It is a flow chart of a collision effect rendering method provided by an embodiment of the present invention, which specifically includes the following steps.
[0030] Step 202: Acquire the collision object that collides in the collision event and the collided object corresponding to the collision object, and determine the collision parameters of the collision event.
[0031] Among them, a collision event refers to a situation in which two or more objects come into contact and interact in a physical simulation or game engine; a collision object refers to an object that collides; a collided object refers to an object that collides with a collision object; and collision parameters include data describing the specific circumstances of the collision, such as collision point, collision force, collision direction, etc.
[0032] In actual applications, the system first detects the occurrence of a collision event through the collision detection module. This module identifies and records the colliding objects and the objects being collided. The collision detection module obtains information about these objects from the physics engine every time a collision occurs. Next, the system analyzes the interaction between the colliding objects and the objects being collided, and calculates and determines the collision parameters of the collision event. These parameters can include the location of the collision point, the force of the collision, the angle of the collision, and its effect on the object. These data are extracted and recorded through the collision parameter determination module, and are usually used for subsequent physical calculations or event processing. The determination of collision parameters can be done through real-time physical simulation algorithms, which take into account the speed, mass, and specific circumstances of the collision.
[0033] In a specific embodiment of the present invention, suppose that in a game, a player character collides with an enemy character. The collision detection module will identify and record the player character as the collision object and the enemy character as the collision object. The system will calculate the coordinates of the collision point, the force and direction of the collision, and generate corresponding collision parameters. These parameters are used to adjust the status of the character, such as the reduction of the character's health or the reaction action after being hit.
[0034] Furthermore, before obtaining the collision object that collides in the collision event and the collided object corresponding to the collision object, and determining the collision parameters of the collision event, it also includes: obtaining the size parameters of the object to be collided and the object to be collided, wherein the object to be collided includes the collision object and the collided object; based on the size parameters, setting a bounding volume for the object to be collided, wherein the bounding volume is used to detect the collision parameters of the collision event, and the bounding volume includes the collision bounding volume of the collision object and the collided bounding volume of the collided object.
[0035] Among them, the collision object refers to the object involved in the collision event, including the collision object and the collision object; the size parameter refers to the physical size information of the collision object, such as length, width, height, etc.; the bounding volume is a geometric body used to detect collision events, usually a simple geometric shape, such as a cube or a sphere, which is used to contain the actual shape of the collision object. The collision bounding volume is the bounding volume of the collision object, and the collision bounding volume is the bounding volume of the collision object.
[0036] In practical applications, the system first obtains the objects to be collided and the size parameters of these objects. The objects to be collided include all related objects in the collision event, that is, the colliding objects and the objects to be collided. The system collects the size parameters of these objects, which usually involve the geometric shape and physical size of the objects.
[0037] Based on these size parameters, the system sets a bounding volume for each object to be collided. The purpose of setting the bounding volume is to simplify the collision detection process. By simplifying the actual object into a simple geometric shape (such as a cube, a sphere, etc.), the system can effectively detect collision events. The specific steps include: Based on the size parameters of the object to be collided, the bounding volume is calculated and constructed. The bounding volume should be large enough to completely contain the actual geometry of the object to be collided.
[0038] Set the collision bounding volume and the collision bounding volume, corresponding to the collision object and the collision object respectively. These bounding volumes are used to monitor the contact and collision between objects.
[0039] The setting of the bounding volume can use geometric calculations and spatial positioning algorithms to ensure that the bounding volume accurately covers the actual shape of the object to be collided with and can effectively detect collision events.
[0040] In a specific embodiment of the present invention, it is assumed that there is a car (collision object) and a wall (collision object) in a simulation environment. The system first obtains the size parameters of the car and the wall, such as the length, width, and height of the car and the thickness and height of the wall. Based on these size parameters, bounding volumes are set for the car and the wall respectively, for example, a rectangular bounding volume is set for the car, and a plane bounding volume is set for the wall. Through these bounding volumes, the system can efficiently detect the collision between the car and the wall, and perform further collision parameter analysis.
[0041] Based on this, the system can simplify the actual shape of the object to be collided and accurately set the bounding volume to efficiently detect and analyze the collision parameters of the collision event, thereby improving the accuracy and efficiency of collision detection.
[0042] Furthermore, collision parameters of the collision event are determined, including: determining a collision speed based on a collision bounding volume of the collision object and a collision bounding volume of the collided object; determining a penetration distance and a collision radius of the collided object based on attribute information of the collision object, attribute information of the object to be collided and the collision speed, and determining the collision speed, penetration distance and collision radius as collision parameters of the collision event.
[0043] Among them, collision speed refers to the speed of the collision object when the collision event occurs; penetration distance refers to the distance that the collision object penetrates the collided object during the collision process; collision radius refers to the effective influence range of the collision object involved in the collision event, usually a circular or spherical area centered on the collision point.
[0044] In practical applications, the system first determines the collision velocity based on the collision bounding volume of the colliding object and the collision bounding volume of the collided object. This process usually involves analyzing the motion state of the colliding objects when the collision occurs. The specific steps include measuring the relative speed of the colliding object and the collided object when they come into contact and calculating the collision velocity. The determination of the collision velocity can be completed through kinematic formulas and collision detection algorithms.
[0045] Next, the system calculates the penetration distance and collision radius of the object being collided based on the attribute information of the collision object, the attribute information of the object to be collided, and the collision speed determined above. The penetration distance refers to the depth of the collision object entering the object being collided during the collision process, which can be calculated based on the collision speed, the properties of the physical material, and the shape of the collision object. The collision radius indicates the impact range of the collision event, which is usually determined by analyzing the shape and collision speed of the collision object.
[0046] Finally, the system uses the collision speed, penetration distance and collision radius as collision parameters of the collision event for further collision analysis and processing. These parameters are crucial for accurately simulating collision effects and evaluating the impact of collisions.
[0047] In a specific embodiment of the present invention, assume that a car (collision object) collides with a wall (collision object). The system first calculates the speed of the car at the moment of collision to obtain the collision speed. Then, based on the speed of the car and the physical properties of the wall, the depth of the car's penetration into the wall (penetration distance) and the impact range of the car's collision (collision radius) are calculated. These collision parameters will be used to further analyze the specific impact of the collision between the car and the wall, such as simulating the impact effect or adjusting the subsequent behavior of the vehicle.
[0048] Based on this, the system can accurately determine the collision parameters of the collision event, including collision speed, penetration distance and collision radius, so as to achieve detailed analysis and efficient processing of the collision event and improve the accuracy of collision simulation and analysis.
[0049] Step 204: determining a collision path of the collision object according to the collision parameters, and determining a target collision surface and a collision position on the target collision surface from a plurality of to-be-collided surfaces of the collision object based on the collision path.
[0050] Among them, the collision path refers to the motion trajectory of the collision object from the start to the end of the collision in a collision event; the target collision surface refers to the surface among the multiple collision surfaces of the collided object that is finally determined as the surface where the collision object actually collides; the collision position refers to the specific position where the collision object contacts the target collision surface.
[0051] In practical applications, first, the system determines the collision path of the collision object through the analysis of collision parameters. This step involves calculating the motion trajectory of the collision object during the collision event, which usually requires considering factors such as the initial velocity, acceleration, and collision time of the object. The collision path can be determined by the simulation results of the physics engine or real-time calculation. Next, based on the determined collision path, the system analyzes multiple collision surfaces of the object being collided. These collision surfaces are the surfaces of the object being collided that can be affected by the collision. The system compares and matches the collision path with these collision surfaces to determine which surface is most likely to become the actual target collision surface. At the same time, the system calculates the collision position on the target collision surface, that is, the specific point or area where the collision object contacts the target collision surface. This process usually involves geometric calculations and spatial analysis to ensure the accurate determination of the collision position.
[0052] In a specific embodiment of the present invention, imagine a car colliding with an obstacle. The system first determines the motion trajectory of the car as the collision path. By analyzing the trajectory of the car and the surface of the obstacle, the system finds which surface of the obstacle is closest to the path of the car, thereby determining the target collision surface. Next, the system calculates the specific location where the car contacts the target collision surface, that is, the precise point or area where the collision occurs.
[0053] Furthermore, before determining the collision path of the collision object according to the collision parameters, and determining the target collision surface and the collision position on the target collision surface from the multiple surfaces to be collided of the collided object based on the collision path, it also includes: obtaining multiple triangular faces of the collided object; based on the vertices of each triangular face, determining each bounding box corresponding to each triangular face according to a preset direction, wherein each bounding box is a cube used to enclose each triangular face.
[0054] The triangle is the basic geometric unit that constitutes the surface of the object being collided, which is defined by three vertices; the bounding box is a cube that is used to enclose the triangle to simplify the collision detection process. Each bounding box is determined by the vertex coordinates of the triangle and can completely cover the triangle.
[0055] In practical applications, first, the system needs to extract all triangular faces from the 3D model of the object being hit. These triangular faces constitute the surface of the object being hit, and each triangular face is defined by three vertices. The system extracts the vertex information of these triangular faces and uses it to construct the corresponding bounding box. The bounding box is a cube whose boundaries can completely cover the triangular faces. The specific steps include: Extract triangular face data: Get the vertex coordinates of each triangular face from the model of the hit object.
[0056] Calculate bounding box: For each triangle, the system first determines the minimum and maximum values of the vertices in 3D space. These values are used to define the boundaries of the bounding box. The boundaries of the bounding box form a cube that can enclose each triangle. When calculating the bounding box, the system determines the length, width, and height of the cube based on these vertex coordinates.
[0057] Apply preset direction: The system adjusts the bounding box according to the preset direction (such as alignment to the world coordinate system). The adjusted bounding box can better match the actual position and direction of the triangle to improve the accuracy of collision detection.
[0058] In a specific embodiment of the present invention, assume that there is a building (the object being hit) whose surface is composed of multiple triangular faces. The system extracts the vertex coordinates of each triangular face from the building model. For example, the vertex coordinates of a triangular face are (1,2,3), (4,5,6), (7,8,9). The system calculates a cubic bounding box based on these vertex coordinates, and the cube completely covers the triangular face. If the minimum and maximum values of the vertex coordinates of the triangular face on the XYZ axis are (0,1,2) and (8,9,10) respectively, then the calculated bounding box boundary will be a cube covering the entire triangular face.
[0059] Based on this, the system can simplify the collision detection process by constructing a bounding box, making the subsequent collision path determination and target collision surface selection more efficient and accurate.
[0060] Furthermore, based on the collision path, a target collision surface and a collision position on the target collision surface are determined from multiple surfaces to be collided of the collided object, including: determining a target bounding box hit by the collision path, and determining the target collision surface from multiple surfaces to be collided of the collided object based on the target bounding box; and determining a collision position on the target collision surface based on the collision path.
[0061] Among them, the collision path refers to the trajectory along which the collision object follows during the collision process; the target bounding box is the bounding box that intersects with the collision path; the target collision surface is the triangular surface that the collision path finally encounters; and the collision position is the specific location where the collision path and the target collision surface intersect.
[0062] In practical applications, the system first determines the target bounding box based on the collision path. The collision path is a line or curve that moves along the collision object. Through it, it interacts with multiple bounding boxes of the collided object to find the bounding box that intersects with the collision path, that is, the target bounding box. The specific steps include: Detect the intersection of the collision path and the bounding box: Calculate whether the collision path intersects with each bounding box. If the collision path intersects with a bounding box, determine that bounding box as the target bounding box.
[0063] Determine the target collision surface: Based on the found target bounding box, select the triangular surface associated with the target bounding box from the multiple collision surfaces of the collided object. The target collision surface refers to the specific triangular surface that intersects with the target bounding box.
[0064] Next, determine the collision position on the target collision surface based on the collision path. This involves calculating the exact location where the collision path intersects the target collision surface. The specific steps include: Calculate the collision position: On the target collision surface, determine the intersection of the collision path and the triangle surface. This can be achieved through geometric calculations or numerical methods to determine the exact location where the collision path intersects the target collision surface.
[0065] Position verification: Verify whether the calculated collision position is within the target collision surface. If the intersection point is outside the target collision surface, it needs to be recalculated or adjusted.
[0066] In a specific embodiment of the present invention, assume that a car (collision object) is traveling along a path, and the collision path intersects with multiple bounding boxes of a building (collision object). The system first detects the collision path of the car and the bounding boxes of the building surface, and finds the bounding box that intersects with the path. Assuming that the bounding box is associated with multiple triangular faces on the building surface, the system further determines that the triangular face associated with the target bounding box is the target collision face. Then, the system calculates the exact location where the car path intersects with the target collision face, and assumes that the collision location is a specific point on the triangular face, and the system uses this point as the final collision location.
[0067] Based on this, the system can accurately determine the intersection between the collision path and the target collision surface and precisely locate the collision position, which helps to improve the accuracy and effect of the collision simulation.
[0068] Step 206: Calculate the collision distance information between the initial position and the collision position in the target collision surface.
[0069] Among them, the initial position refers to any point on the target collision surface, usually a preset position before the collision event occurs; the collision position refers to the specific point where the collision actually occurs; the collision distance information refers to the distance from the initial position to the collision position, which is used to describe the position change when the collision occurs.
[0070] In practical applications, the system first needs to select an initial position on the target collision surface. This initial position can be any point on the target collision surface, usually a preset point determined before the collision occurs. Then, the system records the collision position when the collision event occurs, that is, the specific point where the collision object contacts the target collision surface. Next, the system calculates the distance between the initial position and the collision position. This process involves measuring the spatial distance between the two points, usually by calculating the straight-line distance between them. Geometric distance formulas, such as the Euclidean distance formula, can be used in the calculation process to obtain collision distance information. This information can help analyze the severity of the collision or the impact range of the collision object on the target collision surface.
[0071] In a specific embodiment of the present invention, assume that in a simulation environment, an object collides with a wall. An initial position on the wall is selected, such as the coordinates of a point on the wall. Then the specific position where the object actually collides is recorded. The system calculates the distance between the initial position and the collision position to obtain collision distance information. This information can be used for further collision analysis, such as evaluating the impact of the collision or adjusting the subsequent behavior of the object.
[0072] Furthermore, there are multiple collision objects, and before calculating the collision distance information between the initial position and the collision position in the target collision surface, it also includes: recording the number of collision objects in the collision event; when the number of collision objects is less than a preset number, recording the number of collision objects as the number of collisions; when the number of collision objects is greater than a preset number, retaining the collision information of a preset number of collision objects, and recording the preset number as the number of collisions, wherein the collision information includes collision parameters, the target collision surface corresponding to the collision object, and the collision position on the target collision surface.
[0073] Among them, the collision object refers to the object involved in the collision in the collision event; the number of collisions refers to the number of recorded collision events; the collision information includes collision parameters, the target collision surface of the collision object and the collision position on the target collision surface.
[0074] In practical applications, before calculating the collision distance information between the initial position and the collision position in the target collision surface, the system needs to process and record the relevant data of the collision object. The specific steps include: Record the number of colliding objects: When a collision occurs, the system first records the total number of all objects involved in the collision. This number is used for subsequent processing and analysis.
[0075] Processing collision count: When the number of collision objects is less than the preset number: If the number of objects involved in the collision is less than the preset number set by the system, the system will record the information of all objects involved in the collision and set the collision count to the actual number of collision objects. This means that the system directly processes and records the collision information of all objects. When the number of collision objects is greater than the preset number: If the number of objects involved in the collision is more than the preset number, the system will only retain the collision information of the preset number of collision objects. The system chooses to retain the most important collision object information and sets the collision count to the preset number. The retained collision information includes the collision parameters, target collision surface, and collision position of each collision object.
[0076] Record collision information: Regardless of the number of collision objects, the system will record detailed collision information for each collision object. This information includes: Collision parameters: data describing the collision event, such as speed, direction, force, etc.
[0077] Target collision surface: The target collision surface corresponding to each collision object, that is, the triangular surface that intersects with the collision path.
[0078] Collision position: The specific location where the collision path intersects the target collision surface.
[0079] In a specific embodiment of the present invention, assume that multiple objects collide in a complex scene. The system records the number of all objects involved in the collision. If the actual number of collision objects is 10, and the preset number is 5, the system will select the most important 5 collision objects for recording. These records include the collision parameters of each collision object, the corresponding target collision surface and the collision position. Finally, the number of collisions is set to 5, and the system only pays attention to the detailed collision information of these 5 objects.
[0080] Based on this, the system can reduce the number of collision objects that need to be processed, because the collision effect only needs a certain number of collision objects to be fully expressed, without calculating all collision objects. This not only improves the calculation efficiency, but also avoids unnecessary complex calculations, making collision detection more efficient and accurate.
[0081] Furthermore, the collision distance information between the initial position and the collision position in the target collision surface is calculated, including: for any initial position in the target collision surface, calculating the candidate distance information between the initial position and the collision position corresponding to the collision number and collision objects; based on a preset screening rule, filtering the collision distance information from the candidate distance information.
[0082] The candidate distance information refers to all distance values calculated between the initial position and multiple collision positions; the collision distance information refers to the final collision distance value obtained after screening.
[0083] In practical applications, the initial position in the target collision surface is first determined. For example, it can be a starting point in a collision detection algorithm. Next, the system identifies all collision objects and their collision positions on the target collision surface. These collision positions may be multiple points that intersect with the target collision surface. For each collision position, the system calculates the distance from the initial position to the collision position. These calculated distance values are candidate distance information. The system organizes all candidate distance information into a set, such as a distance array. Next, the system selects the distance value that best meets the requirements from these candidate distance information according to preset filtering rules. The preset filtering rule can be to select the collision position with the smallest distance, that is, the collision position closest to the initial position. The system finds the smallest distance value from the candidate distance information as the final collision distance information, and records its corresponding collision position.
[0084] In a specific embodiment of the present invention, a target collision surface and an initial position P are provided, and multiple collision objects collide with the target collision surface. Assume that the collision positions of the collision objects are C1, C2, C3, etc. The system calculates the distance from the initial position P to these collision positions C1, C2, C3, and obtains a candidate distance information set, such as {5.2, 1.7, 3.6}{5.2, 1.7, 3.6}. The system applies a preset screening rule to select the value with the smallest distance, such as 1.7. Finally, the collision position corresponding to the distance value 1.7 is selected as the final collision distance information.
[0085] Based on this, the system can accurately select the collision position closest to the initial position from multiple collision positions, thereby improving the accuracy and efficiency of collision detection and ensuring that the processing results are more in line with the actual collision situation.
[0086] Step 208: Rendering a collision effect on the target collision surface based on the collision distance information and the collision parameters.
[0087] Among them, the collision distance information refers to the distance from the initial position on the target collision surface to the collision position, which describes the position change when the collision occurs; the collision parameters include various information related to the collision event, such as collision force, collision direction, etc., which are used to describe the specific circumstances of the collision; rendering collision effect refers to visualizing the results of the collision event on the target collision surface, such as generating visual effects or traces of the collision.
[0088] In actual application, the system first integrates the collision distance information with the collision parameters. The collision distance information provides the position change when the collision occurs, while the collision parameters describe the detailed nature of the collision. These data will be input into the collision effect rendering module, which is responsible for generating visual collision effects.
[0089] The specific steps include: the system converts the collision distance information into the format required for rendering effects, for example, by calculating the impact range and effect strength of the collision. Then, based on the collision parameters, such as collision force and collision direction, specific visual effects are generated. This may include creating visual traces on the target collision surface, such as dents, cracks or other collision traces. The rendering module can use techniques such as texture mapping and deformation algorithms to achieve these effects. Finally, the system applies the generated effects to the target collision surface and fine-tunes them according to the actual rendering effect to ensure that the effect meets the expected visual effect.
[0090] In a specific embodiment of the present invention, imagine a game scene where a car collides with a wall. The system first calculates the collision distance information of the car and the wall, and records parameters such as the force and direction of the collision. The system then uses this information to generate the collision effect of the wall, for example, rendering the dents and cracks left by the collision on the wall. The rendering effect is adjusted according to the collision distance and collision parameters to ensure that the effect truly reflects the collision situation.
[0091] Furthermore, before rendering the collision effect on the target collision surface based on the collision distance information and the collision parameters, it also includes: generating a distance field map for the target collision surface based on the collision distance information, wherein the distance field map is used to describe the distance information between each position on the target collision surface and the collision position.
[0092] The distance field map is an image used to represent the distance from each position on the target collision surface to the collision position.
[0093] In practical applications, first, the system generates a distance field map based on the collision distance information. To achieve this goal, the system needs to first determine every position on the target collision surface. These positions are usually achieved by dividing the target collision surface into a grid or point set. Next, the system calculates the distance from each grid point or position on the target collision surface to the collision position. These distances can be calculated using Euclidean distance or other suitable distance measurement methods.
[0094] After the calculation is completed, the system populates the distance value of each grid point into the distance field map. Specifically, the distance value is mapped to the pixel value of the image to generate the distance field map. This process may involve normalizing the distance value to a specific range and using different colors or grayscale values to represent the distance. The generated distance field map will show the distance distribution of each position on the target collision surface to the collision position.
[0095] During the processing, the system may also post-process the generated distance field map to remove noise, smooth the image, and improve the clarity of the image. This can help ensure that the final rendering is more accurate and detailed.
[0096] In a specific embodiment of the present invention, it is assumed that the target collision surface is divided into a uniform grid and has multiple collision positions. The system calculates the distance from each point in the grid to these collision positions and maps these distance values to the pixels of the distance field map to generate a two-dimensional image. This image uses different colors to represent the distance, thereby clearly showing the impact area of the collision position on the target collision surface.
[0097] Based on this, the system can generate a detailed distance field map, which intuitively shows the distance information between each position on the target collision surface and the collision position. This image helps to accurately display the collision effect during the rendering process, enhancing the realism and accuracy of the visual effect.
[0098] Furthermore, based on the collision distance information and the collision parameters, a collision effect is rendered on the target collision surface, including: determining a target rendering position according to the distance field map; determining a collision map according to the attribute information of the collision object, the attribute information of the collided object and the collision parameters; rendering the collision map to the target rendering position to obtain a collision effect on the target collision surface.
[0099] Among them, the collision map refers to the map used to describe the collision effect.
[0100] In actual applications, first, the system determines the target rendering position based on the distance field map. The target rendering position is usually the position corresponding to the collision position. Then, the system determines the collision map based on the attribute information of the collision object and the attribute information of the collided object combined with the collision parameters. These attribute information include color, texture, normal, transparency, etc., while the collision parameters may include energy, speed, hardness, etc. Based on this information, the system determines a suitable collision map so that it performs well when rendering. Then the determined collision map is rendered to the previously determined target rendering position to obtain the final collision effect. This effect will be displayed on the target collision surface and can show the specific collision process and results.
[0101] In a specific embodiment of the present invention, assuming that the target collision surface is divided into a grid, the system determines several areas as target rendering positions based on the distance field map. Then, the system reads the attribute information of the collision object and the collided object, and determines a specific condition based on the collision parameters to generate a suitable collision map. This map is rendered on these selected target rendering positions, and finally a collision effect on the target collision surface is obtained. This effect shows the visual reflection of the physical reaction when the objects come into contact.
[0102] Based on this, the system can accurately determine the target rendering position based on the distance field map and collision parameters, and determine the collision map based on the attribute information, and render the map to the target position. This method can effectively improve the authenticity of the rendering effect and make the collision effect more dynamic and realistic.
[0103] Furthermore, based on the collision distance information and the collision parameters, a collision effect is rendered on the target collision surface, including: obtaining a collision surface material map and a collision effect map of the target collision surface; mixing the collision surface material map and the collision effect map according to a preset random function to obtain a mixed map; based on the collision distance information and the collision parameters, rendering the mixed map on the target collision surface.
[0104] The collision surface texture map is used to represent the texture of the original appearance of the surface. The collision effect texture map is used to represent the texture of the surface changes after the collision. The preset random function is used to control the blending method of the collision surface texture map and the collision effect texture map to achieve a more natural visual effect. The blended texture contains comprehensive information about the surface state before and after the collision.
[0105] In practical applications, it is first necessary to obtain the collision surface material map and collision effect map of the target collision surface. The collision surface material map usually reflects the appearance of the collision surface when it is not affected by the collision, such as the texture of a normal road. The collision effect map reflects the impact after the collision, such as the texture of a damaged road. For example, in a road model, the map of the normal road can be generated by the texture atlas method, and the variants of four road surface maps are spliced into an atlas, thereby reducing the number of sampled maps and the number of calculations. The map of the damaged road can be an independent texture coordinate uv, which is continuous in the v direction, which is convenient for hexagonal UV fusion calculation and is conducive to calculating the UV coordinates of the mixed part of the road and the ground.
[0106] Next, the two maps are mixed according to a preset random function. The preset random function can be based on a noise function or other random algorithm to control the degree and position of the mix, making the mixed effect more natural and random, avoiding the repetitive feeling brought by a fixed pattern. For example, on the road, the collision effect can be manifested as the random appearance of damaged areas, and the size and shape of the damaged areas can be controlled by a random function, see Figure 3 As shown in the figure, the normal road surface, random damaged road surface A and random damaged road surface B, Figure 3 Schematic diagram of a collision effect provided by an embodiment of the present invention. The mixed map is called a mixed map, which contains comprehensive information of the surface state before and after the collision.
[0107] Finally, based on the collision distance information and collision parameters, a mixed map is rendered on the target collision surface. The collision distance information describes the position of the collision point relative to the collision surface, while the collision parameters include information such as the collision speed and angle. This information is used to determine the specific manifestation of the collision effect. For example, when the collision speed is high, a larger damaged area can be produced; different collision angles may result in different damage shapes. In addition, by using the smoothstep function, the sharpness and parallax effect of the edge of the damaged area can be controlled, and the processing from hard edge to soft edge and from strong parallax to weak parallax can be achieved, which improves the delicacy of the visual effect. See Figure 3 Take the random damaged road surface A and the damaged road surface with unprocessed edge sharpness, and the random damaged road surface A and the damaged road surface with weak parallax as examples.
[0108] In a specific embodiment of the present invention, it is assumed that there is a model representing a road, and the road needs to display damage effects after a collision. The system first obtains the normal road surface map of the road, which is a texture atlas composed of multiple road surface variants, reducing the number of sampled maps and the number of calculations. Then, the system obtains the damaged road map, which uses independent UV coordinates and is continuous in the v direction, which is convenient for hexagonal UV fusion calculations. Otherwise, discontinuous seams will be generated. See Figure 3 Next, the system uses a preset random function (such as a noise function) to control the blending of the normal road texture and the damaged road texture to generate a mixed texture. For example, when a car hits the road, the system uses a noise function to randomly generate the position and size of the damaged area according to the speed and angle of the collision, and renders a mixed texture in the area to show the damage effect.
[0109] Specifically, assuming that the collision occurs at a specific location on the road, the system will calculate the size and shape of the damaged area based on the collision parameters. Using the noise function can make the distribution of the damaged area more random, increasing the sense of reality and unpredictability. In addition, by using the smoothstep function, the sharpness of the edge of the damaged area can be controlled to achieve the transition from hard edge to soft edge, which improves the delicateness of the visual effect. Through hexagonal UV blending, the visual repetition caused by traditional map tiling is reduced, making the map more natural, see Figure 3 The random damaged pavement A and the paved damaged pavement are shown in Figure 1.
[0110] Based on this, by mixing the collision surface material map with the collision effect map, the system can achieve dynamic display of the collision effect and enhance the visual realism. By using texture atlases and independent UV coordinates, not only the rendering overhead is reduced, but also the flexibility and scalability of the model are improved. The system can accurately simulate the surface changes after the collision, providing users with a more immersive experience. In addition, through the implementation of real-time random changes and parallax effects, the collision effect is more three-dimensional and natural, saving the number of model vertices and optimizing performance.
[0111] An embodiment of the present invention realizes obtaining a collision object that collides in a collision event, and a collided object corresponding to the collision object, and determining collision parameters of the collision event; determining a collision path of the collision object according to the collision parameters, and based on the collision path, determining a target collision surface and a collision position on the target collision surface from multiple surfaces to be collided of the collided object; calculating collision distance information between an initial position and a collision position in the target collision surface; rendering a collision effect on the target collision surface based on the collision distance information and the collision parameters. This scheme calculates the collision distance information of the target collision surface through the collision path of the collision object and the collided object obtained in the collision event, and then renders the collision effect through the collision distance information and the collision parameters. Therefore, there is no need to render the collision effect on all surfaces of the collided object, thereby reducing the pressure on the video memory. At the same time, compared with pre-storing decal textures, the collision distance information will take up less storage space.
[0112] The following combination Figure 4 Taking the application of the collision effect rendering method provided by the present invention in a game where a bullet hits a mecha as an example, the collision effect rendering method is further described. Figure 4 It is a process flow chart of a collision effect rendering method provided by an embodiment of the present invention, which specifically includes the following steps.
[0113] Step 402: Bind capsule collisions to the components on the surface of the mecha. After the bullet hits, record the bullet's hit position, direction, damage radius, and penetration distance.
[0114] It can be understood that the capsule body is the aforementioned enclosing body, the components on the surface of the mecha are the aforementioned objects to be hit, and the position, direction, damage radius, and penetration distance of the bullet hit are the aforementioned collision parameters.
[0115] Step 404: A new rendering process is added and executed before the actual rendering operation. This stage is just after the engine executes GPU skinning. At this time, the skinning results of the object can be reused to save computing power.
[0116] Step 406: pass the hit information to the compute shader, and use the GPU to roughly solve the collision hit for each face of the model (convert the triangular face into an axis-aligned bounding box, and perform the axis-aligned bounding box along the bullet path for cylindrical collision detection), remove the faces that are not hit (reduce the faces that need to be drawn later, speed up the drawing speed of the distance field map), and the hit face records the indexes of the first six valid bullets that hit it.
[0117] It can be understood that there are three-dimensional coordinate axes in the rendering environment, and the bounding box is a cube whose sides are parallel to the three-dimensional coordinate axes, which is convenient for subsequent calculations. The hit surface is the aforementioned target collision surface, and the "index of the first six valid bullets" is the collision information corresponding to the aforementioned preset number of collision objects.
[0118] Step 408: Execute the drawing command, pass the pre-processed data into the drawing shader, iterate each pixel six times, calculate the distance from the corresponding position of each pixel to the hit point, record the minimum value, and when the drawing is completed, a nearest hit point distance field map can be obtained.
[0119] See also Figure 5 As shown, Figure 5 This is a schematic diagram of a distance field graph provided by an embodiment of the present invention. As shown in the figure, the black area indicates that there is a bullet hitting the position and a collision effect needs to be rendered.
[0120] Step 410: Based on the hit distance field map, specific shading calculations are performed to achieve collision effects such as bullet holes, shield ripples, and road damage.
[0121] See also Figure 6 As shown, Figure 6 This is another schematic diagram of a collision effect provided by an embodiment of the present invention. As shown in the figure, Figure 6 The battle damage crater effect and wave shield effect rendered after the bullet hits the mecha.
[0122] Corresponding to the above method embodiment, the present invention also provides a collision effect rendering device embodiment, Figure 7 FIG. 1 is a schematic diagram of a collision effect rendering device provided by an embodiment of the present invention. Figure 7 As shown, the device comprises: The acquisition module 702 is configured to acquire the collision object that collides in the collision event and the collided object corresponding to the collision object, and determine the collision parameters of the collision event; The determination module 704 is configured to determine a collision path of the collision object according to the collision parameters, and determine a target collision surface and a collision position on the target collision surface from a plurality of to-be-collided surfaces of the collision object based on the collision path; A calculation module 706 is configured to calculate collision distance information between an initial position and a collision position in a target collision surface; The rendering module 708 is configured to render a collision effect on the target collision surface based on the collision distance information and the collision parameters.
[0123] Optionally, the collision effect rendering device also includes a setting module, which is configured to obtain the objects to be collided and the size parameters of the objects to be collided, wherein the objects to be collided include the colliding objects and the collided objects; based on the size parameters, a bounding volume is set for the objects to be collided, wherein the bounding volume is used to detect the collision parameters of the collision event, and the bounding volume includes the collision bounding volume of the colliding object and the collided bounding volume of the collided object.
[0124] Optionally, the acquisition module 702 is further configured to determine the collision speed based on the collision bounding volume of the colliding object and the collision bounding volume of the collided object; determine the penetration distance and collision radius of the collided object based on the attribute information of the colliding object, the attribute information of the object to be collided and the collision speed, and determine the collision speed, penetration distance and collision radius as collision parameters of the collision event.
[0125] Optionally, the collision effect rendering device also includes a bounding box setting module, which is configured to obtain multiple triangular faces of the collided object; based on the vertices of each triangular face, determine each bounding box corresponding to each triangular face according to a preset direction, wherein each bounding box is a cube used to enclose each triangular face.
[0126] Optionally, the determination module 704 is further configured to determine a target bounding box hit by the collision path, and determine a target collision surface from multiple to-be-collided surfaces of the collided object based on the target bounding box; and determine a collision position on the target collision surface based on the collision path.
[0127] Optionally, the collision effect rendering device also includes a recording module, which is configured to record the number of collision objects in a collision event; when the number of collision objects is less than a preset number, the number of collision objects is recorded as the number of collisions; when the number of collision objects is greater than a preset number, the collision information of a preset number of collision objects is retained, and the preset number is recorded as the number of collisions, wherein the collision information includes collision parameters, a target collision surface corresponding to the collision object, and a collision position on the target collision surface.
[0128] Optionally, the calculation module 706 is further configured to calculate candidate distance information of a collision position corresponding to a collision number and a collision object at any initial position in the target collision surface; and filter the collision distance information from the candidate distance information based on a preset filtering rule.
[0129] Optionally, the collision effect rendering device further includes a generating module configured to generate a distance field map for the target collision surface based on the collision distance information, wherein the distance field map is used to describe the distance information between each position on the target collision surface and the collision position.
[0130] Optionally, the rendering module 708 is further configured to determine the target rendering position according to the distance field map; determine the collision map according to the attribute information of the collision object, the attribute information of the collided object and the collision parameters; render the collision map to the target rendering position to obtain the collision effect on the target collision surface.
[0131] Applied to the collision rendering device, the acquisition module 702 first extracts the collision object, the collided object and its collision parameters from the collision event, and passes this information to the determination module 704. The determination module 704 calculates the collision path based on the collision parameters, further selects the target collision surface from the multiple collision surfaces of the collided object, and determines the collision position. Next, the calculation module 706 performs calculations based on the distance information between the initial position and the collision position in the target collision surface. These calculation results are applied to the target collision surface through the rendering module 708 to render the final collision effect. In this way, the effect only needs to be rendered on the target collision surface instead of processing all surfaces of the collided object, thereby reducing the use of video memory. At the same time, compared with pre-storing decal textures, the collision distance information occupies less storage space, which further optimizes storage requirements and performance.
[0132] The above is a schematic scheme of a collision effect rendering device of this embodiment. It should be noted that the technical scheme of the collision effect rendering device and the technical scheme of the collision effect rendering method described above belong to the same concept, and the details of the technical scheme of the collision effect rendering device that are not described in detail can all be referred to the description of the technical scheme of the collision effect rendering method described above.
[0133] Figure 8 The structure block diagram of a computing device 800 provided according to an embodiment of the present invention is shown. The components of the computing device 800 include but are not limited to a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.
[0134] The computing device 800 also includes an access device 840 that enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 840 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0135] In one embodiment of the present invention, the above components of the computing device 800 and Figure 8 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 8 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present invention. Those skilled in the art may add or replace other components as needed.
[0136] The computing device 800 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 800 may also be a mobile or stationary server.
[0137] The processor 820 is used to execute the following computer program / instruction, which implements the steps of the above-mentioned collision effect rendering method when executed by the processor.
[0138] The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computing device embodiment, since it is basically similar to the collision effect rendering method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the collision effect rendering method embodiment.
[0139] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned collision effect rendering method when executed by a processor.
[0140] Each embodiment of the present invention is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computer-readable storage medium embodiment, since it is basically similar to the collision effect rendering method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the collision effect rendering method embodiment.
[0141] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned collision effect rendering method when executed by a processor.
[0142] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the collision effect rendering method described above are of the same concept, and the details not described in detail in the technical scheme of the computer program product can be found in the description of the technical scheme of the collision effect rendering method described above.
[0143] The above describes specific embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0144] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0145] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present invention.
[0146] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0147] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of the present invention. The present invention selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A collision effect rendering method, characterized in that: include: Acquire a collision object that collides in a collision event and a collided object corresponding to the collision object, and determine a collision parameter of the collision event; Determining a collision path of the collision object according to the collision parameters, and determining a target collision surface and a collision position on the target collision surface from a plurality of to-be-collided surfaces of the collided object based on the collision path; Calculating collision distance information between an initial position in the target collision surface and the collision position; Based on the collision distance information and the collision parameters, a collision effect is rendered on the target collision surface.
2. The method according to claim 1, characterized in that: Before obtaining the collision object that collides in the collision event and the collided object corresponding to the collision object, and determining the collision parameters of the collision event, the method further includes: Acquire the object to be collided and the size parameters of the object to be collided, wherein the object to be collided includes the colliding object and the collided object; Based on the size parameter, a bounding volume is set for the object to be collided, wherein the bounding volume is used to detect the collision parameter of the collision event, and the bounding volume includes a collision bounding volume of the collision object and a collided bounding volume of the collided object.
3. The method according to claim 2, characterized in that The determining of the collision parameters of the collision event comprises: Determining a collision speed based on a collision bounding volume of the collision object and a collision bounding volume of the collision object; Based on the attribute information of the collision object, the attribute information of the object to be collided and the collision speed, the penetration distance and the collision radius of the collided object are determined, and the collision speed, the penetration distance and the collision radius are determined as collision parameters of the collision event.
4. The method according to claim 1, characterized in that: Before determining the collision path of the collision object according to the collision parameters and determining a target collision surface and a collision position on the target collision surface from a plurality of to-be-collided surfaces of the collided object based on the collision path, the method further includes: Acquire multiple triangular faces of the collided object; Based on the vertices of each triangular face, each bounding box corresponding to each triangular face is determined according to a preset direction, wherein each bounding box is a cube for enclosing each triangular face.
5. The method according to claim 4, characterized in that The step of determining a target collision surface and a collision position on the target collision surface from a plurality of to-be-collided surfaces of the collided object based on the collision path comprises: Determine a target bounding box hit by the collision path, and determine a target collision surface from a plurality of to-be-collided surfaces of the collided object based on the target bounding box; Based on the collision path, a collision position is determined on the target collision surface.
6. The method according to claim 1, characterized in that There are multiple collision objects, and before calculating the collision distance information between the initial position in the target collision surface and the collision position, the method further includes: recording the number of the collision objects in the collision event; When the number of the collision objects is less than a preset number, the number of the collision objects is recorded as the number of collisions; When the number of collision objects is greater than the preset number, collision information of the preset number of collision objects is retained, and the preset number is recorded as the number of collisions, wherein the collision information includes the collision parameters, the target collision surface corresponding to the collision object, and the collision position on the target collision surface.
7. The method according to claim 6, characterized in that The calculating the collision distance information between the initial position in the target collision surface and the collision position includes: For any initial position in the target collision surface, calculating candidate distance information between the initial position and the collision position corresponding to the collision objects of the collision number; Based on a preset screening rule, the collision distance information is screened from the candidate distance information.
8. The method according to claim 1, characterized in that: Before rendering the collision effect on the target collision surface based on the collision distance information and the collision parameters, the method further includes: Based on the collision distance information, a distance field map for the target collision surface is generated, wherein the distance field map is used to describe distance information between each position on the target collision surface and the collision position.
9. The method according to claim 8, characterized in that The rendering of the collision effect on the target collision surface based on the collision distance information and the collision parameters includes: Determining a target rendering position according to the distance field map; Determine a collision map according to the attribute information of the collision object, the attribute information of the collided object and the collision parameters; The collision map is rendered to the target rendering position to obtain a collision effect on the target collision surface.
10. The method according to claim 1, characterized in that The rendering of the collision effect on the target collision surface based on the collision distance information and the collision parameters includes: Obtaining a collision surface material map and a collision effect map of the target collision surface; Mixing the collision surface material map and the collision effect map according to a preset random function to obtain a mixed map; The mixed map is rendered on the target collision surface based on the collision distance information and the collision parameters.
11. A collision effect rendering device, characterized in that: include: An acquisition module is configured to acquire a collision object that collides in a collision event and a collision object corresponding to the collision object, and determine a collision parameter of the collision event; a determination module configured to determine a collision path of the collision object according to the collision parameters, and determine a target collision surface and a collision position on the target collision surface from a plurality of to-be-collided surfaces of the collided object based on the collision path; A calculation module, configured to calculate collision distance information between an initial position in the target collision surface and the collision position; A rendering module is configured to render a collision effect on the target collision surface based on the collision distance information and the collision parameters.
12. A computing device, characterized in that: include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the collision effect rendering method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which, when executed by a processor, implements the steps of the collision effect rendering method described in any one of claims 1 to 10.
14. A computer program product, characterized in that The invention comprises a computer program / instruction, which, when executed by a processor, implements the steps of the collision effect rendering method described in any one of claims 1 to 10.