Interaction effect rendering method and device
By determining the interaction space and rendering texture in the target map of the virtual world, and calculating object attributes and state information based on interaction events, the memory and calculation overhead problems caused by the excessive size of RenderTexture is solved, and efficient interactive rendering is achieved.
Patent Information
- Application Number
- CN202510270690.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-06-13
AI Technical Summary
In the virtual world, the existing technology realizes GPU interaction by creating a RenderTexture covering the entire big world area, resulting in the RenderTexture being too large in size, occupies too much memory and video memory, and makes computing overhead difficult to optimize.
By determining the interaction space with the target object as the coordinate origin in the target map, an initial rendering texture corresponding to the interaction space is created, and the attribute information and status information of the first and second objects are determined based on the interaction events triggered by the target object, and the target rendering texture is obtained to achieve rendering of the interactive effect.
This method can reasonably limit the size of the rendered texture, avoid affecting the system performance, and realize real-time rendering of interactive effects at any location on the target map, achieving more realistic visual effects.
Smart Images

Figure CN120147204A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and particularly to a method and device for rendering interaction effects. Background Art
[0002] Rendering refers to the process of generating an image based on texture data, light data, etc. in computer device drawing. The rendering process is generally completed by a graphics processing unit (GPU). RenderTexture is a tool that can create and operate textures on the GPU. Based on RenderTexture, GPU interaction can be achieved, thereby obtaining a more vivid and realistic picture rendering effect.
[0003] In a virtual world, in order to achieve GPU interaction, it is necessary to create a RenderTexture that can cover the entire world area. However, this method will cause the RenderTexture to be too large in size, thus occupying too much memory and video memory, and it is also difficult to optimize the calculation overhead. Therefore, there is an urgent need for a more efficient method for rendering interaction effects. Summary of the Invention In view of this, the embodiments of this specification provide a method for rendering interaction effects. One or more embodiments of this specification also relate to a device for rendering interaction effects, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0004] According to the first aspect of the embodiments of this specification, a method for rendering interaction effects is provided, including: In a target map, determine an interaction space with a target object as the coordinate origin, and create an initial rendering texture corresponding to the interaction space; Based on an interaction event triggered by the target object, determine a first object and a second object in the interaction space, where the first object is an object that interacts with the second object and generates an interaction effect on the second object; Determine the attribute information of the first object in the initial rendering texture, and calculate the state information of the second object according to the attribute information to obtain a target rendering texture; Based on the target rendering texture, render and display the interaction effect on the second object.
[0005] According to the second aspect of the embodiments of this specification, a device for rendering interaction effects is provided, including: A creation module, configured to determine an interaction space with a target object as the coordinate origin in a target map, and create an initial rendering texture corresponding to the interaction space; A determination module, configured to determine a first object and a second object in an interaction space based on an interaction event triggered by a target object, where the first object is an object that interacts with the second object and has an interaction effect on the second object; A calculation module, configured to determine the attribute information of the first object in an initial rendering texture, and calculate the state information of the second object based on the attribute information to obtain a target rendering texture; A rendering module, configured to render and display an interaction effect on the second object based on the target rendering texture.
[0006] According to the third aspect of the embodiments of this specification, a computing device is provided, including: A memory and a processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the above-mentioned rendering method for interaction effects are implemented.
[0007] According to the fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions. When the instructions are executed by a processor, the steps of the above-mentioned rendering method for interaction effects are implemented.
[0008] According to the fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of the above-mentioned rendering method for interaction effects are implemented.
[0009] One embodiment of this specification realizes determining an interaction space with a target object as the coordinate origin in a target map, and creating an initial rendering texture corresponding to the interaction space; based on an interaction event triggered by the target object, determining a first object and a second object in the interaction space, where the first object is an object that interacts with the second object and has an interaction effect on the second object; determining the attribute information of the first object in the initial rendering texture, and calculating the state information of the second object based on the attribute information to obtain a target rendering texture; rendering and displaying an interaction effect on the second object based on the target rendering texture.
[0010] In this way, by determining an interaction space with a target object as the coordinate origin in a target map, the first object and the second object can both be transformed into the coordinate system corresponding to the interaction space, so that a rendering texture that follows the movement of the target object can be created, and the size of the rendering texture can be reasonably restricted to avoid affecting system performance; by calculating the state information of the second object based on the attribute information, it is possible to simulate the interaction effect of the first object on the second object based on the target rendering texture at any position in the target map, and realize real-time rendering of the interaction effect, thereby obtaining a more realistic visual effect. Description of the Drawings
[0011] Figure 1 is a flowchart of a method for rendering an interaction effect provided by an embodiment of this specification; Figure 2 is a flowchart of the processing procedure of a method for rendering an interaction effect provided by an embodiment of this specification; Figure 3 is a schematic structural diagram of a device for rendering an interaction effect provided by an embodiment of this specification; Figure 4 is a structural block diagram of a computing device provided by an embodiment of this specification. Detailed Embodiments
[0012] In the following description, numerous specific details are set forth in order to provide a thorough understanding of this specification. However, this specification can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the connotation of this specification. Therefore, this specification is not limited by the specific embodiments disclosed below.
[0013] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "the", and "said" used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more of the associated listed items.
[0014] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, such 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 this specification, the first can also be referred to as the second, and similarly, the second can also be referred to as the first. Depending on the context, the word "if" as used herein can be interpreted as "when", "while", 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 for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data that have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of the relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entrances are provided for the user to choose to authorize or refuse.
[0016] First, the noun terms related to one or more embodiments of this specification are explained.
[0017] GPU (Graphics Processing Unit, graphics processing unit): The core component of a graphics card (Graphics Card), responsible for performing complex mathematical and geometric calculations to render images, videos, or other graphical content.
[0018] RT (RenderTexture, render texture): A texture dynamically created at runtime, which can be used as the input of a shader or displayed on any material in the game world.
[0019] ComputerShader (shader program): Used to simulate and calculate physical phenomena and can perform general computing tasks.
[0020] In this specification, a method for rendering an interaction effect is provided. This specification also relates to a device for rendering an interaction effect, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail one by one in the following embodiments.
[0021] See Figure 1 , Figure 1 shows a flowchart of a method for rendering an interaction effect provided according to an embodiment of this specification, which specifically includes the following steps.
[0022] Step 102: In the target map, determine an interaction space with the target object as the coordinate origin, and create an initial render texture corresponding to the interaction space.
[0023] In practical applications, in the target map, an interaction space with the target object as the coordinate origin can be determined, and an initial render texture corresponding to the interaction space can be created, so that the render texture can move with the movement of the target object, realizing GPU interaction computing.
[0024] Specifically, the target map can be a map in the virtual world of a game or a map corresponding to the background area of a video or animation. The target object is an object moving in the target map. For example, it can be an object controlled by the user's operation, specifically including virtual characters, mechas, etc. operated by players in the game. The interaction space can be understood as a two-dimensional or three-dimensional area with a certain size constructed based on the target object and centered on the target object, which is an area in the target map. The initial render texture can be understood as a render texture created for the interaction space and can be used to record the map data within the interaction space.
[0025] In actual applications, when the user operates the target object to move, the target object can trigger interactive events on various scene objects in the target map. For example, scene objects can include objects in the map (such as stones, boxes, trees, etc.), NPCs, monsters, water surfaces, etc. Interactive events can include: running over water surfaces, running over land, talking to NPCs, firing bullets, artillery shells, etc. In order to improve the realism of visual effects, bring better visual experience to users, and increase the interactivity of the screen, corresponding interactive effects can be designed for interactive events and rendered and displayed in the screen.
[0026] Exemplarily, the interactive effects may include: when the player operates the mecha to run through vegetation, the vegetation collapses in a preset direction; when the player operates the mecha to run through the water, foam and waves are generated on the water surface; when the player operates the mecha to run through land, indentations are generated on the ground; when the player operates the mecha to fire shells, a burning effect will be generated on the vegetation, and the burning effect will spread in a certain direction, and so on.
[0027] In order to achieve rich interactive effects in the target map, it is usually necessary to use RenderTexture and GPU interactive calculation to render and display the interactive effects corresponding to the interactive events in the screen. However, since the size of the target map is often large, creating RenderTexture for the target map will occupy a large amount of memory and video memory, and the GPU calculation overhead will also increase exponentially, and it is difficult to obtain a good optimization effect.
[0028] Based on this, one or more embodiments of this specification determine an interactive space with the target object as the coordinate origin in the target map. In this way, all scene objects in the interactive space in the target map can be converted to the coordinate system corresponding to the interactive space, thereby constructing an interactive implementation based on the interactive space.
[0029] For example, when the target object is a mecha, the space from the center to a certain distance around the mecha is determined as the interactive space. By processing the interactive events in the interactive space, the size of the RenderTexture can be limited to a controllable range, thereby realizing GPU interactive computing.
[0030] According to an optional embodiment of the present specification, creating an initial rendering texture corresponding to the interactive space may include: Determine the target scene object in the interactive space and map the target scene object to the initial rendering texture.
[0031] Specifically, the target scene object can be understood as a scene object within the area of the interactive space in the target map. The target scene object can include scene objects that can perform interactions, such as the first object and the second object; it can also include objects that cannot perform interactions, such as decorations and ornaments in the map.
[0032] Furthermore, mapping the target scene object to the initial rendering texture can be achieved by creating a RenderTexture object and adding the RenderTexture object to the virtual camera.
[0033] Optionally, the virtual camera can be a camera already created in the target map or a newly created camera.
[0034] Specifically, the initial rendering texture can include position information, transparency information, lighting information, etc. of each scene object in the interactive space. These information are obtained based on the target object and are information relative to the target object.
[0035] Optionally, in the target map, determining the interactive space with the target object as the coordinate origin can include the following steps: Determine the current frame position of the target object in the target map as the coordinate origin; Determine the interactive space with the target object as the coordinate origin according to the preset space size.
[0036] Specifically, the current frame position can be understood as the position information of the target object in the target map of the current frame.
[0037] In an optional embodiment of this specification, the preset space size can be the default size.
[0038] In another optional embodiment of this specification, the preset space size can be determined according to information such as image quality and resolution.
[0039] Optionally, the visibility can be set according to the image quality grading, and different space sizes corresponding to different image qualities can be preset based on different visibilities. Exemplarily, the value range of the space size corresponding to high image quality can be between 800m - 900m; the space sizes corresponding to other image qualities can decrease in sequence.
[0040] Applying this embodiment, by determining the current frame position of the target object in the target map as the coordinate origin, and determining the interaction space with the target object as the coordinate origin according to the preset spatial size, it is possible to create a rendering texture with the target object as the center point within a limited area, realize the real-time calculation of interaction events in the interaction space, thereby realizing the rendering of interaction effects, and the interaction space can move along with the movement of the target object. Thus, no matter where the target object moves to in the target map, the rendering of interaction effects can be realized, and the rendering efficiency of interaction effects can be effectively improved.
[0041] Step 104: Based on the interaction event triggered by the target object, determine the first object and the second object in the interaction space, where the first object is the object that interacts with the second object and produces an interaction effect on the second object.
[0042] In practical applications, the first object and the second object in the interaction space can be determined based on the interaction event triggered by the target object.
[0043] Specifically, the interaction event can be understood as an event in which the target object triggers an interaction with the scene object in the target map. Exemplarily, the interaction event can include: water surface interaction, terrain indentation interaction, vegetation interaction, etc. Among them, the water surface interaction can include the interaction that occurs when the target object runs across the water surface, and can also include the interaction that occurs when the target object launches a skill or makes some specific actions, such as a cannonball hitting the water surface. The terrain indentation interaction can be understood as the indentation caused to the ground when the target object runs across the ground; the vegetation interaction can include the surrounding vegetation being crushed when the target object runs through the vegetation area, and can also include effects such as burning of the vegetation caused when the target object launches a skill or makes some specific actions. The scene object can be understood as an entity or element included in the scene of the target map, such as terrain and landforms, building facilities, animals and plants, props and items, etc. The scene object generally includes visible or invisible attributes, interactable or non-interactable attributes, etc.
[0044] Optionally, based on the interaction event triggered by the target object, the first object and the second object located in the interaction space can be determined.
[0045] Specifically, the first object can be understood as an object that can interact with the second object and have an impact on the second object. The impact exerted by the first object on the second object can be rendered as an interaction effect. The first object can specifically include the target object, other interaction objects generated based on the target object (such as shells, flames, water flows, smoke, etc. emitted by the target object), additional objects of the target object (such as following pets, summons, etc.), and weapons, equipment, etc. that can be custom-added within a preset distance of the target object. Among them, the target object can be a virtual character, mecha, machine, etc. operated by the player; other interaction objects can include skills launched by the target object, weapons fired, objects thrown, etc. Exemplarily, when the target object is a mecha, other interaction objects can include bullets, shells, etc. fired by the mecha.
[0046] Specifically, the second object can be understood as an object that responds to the interaction of the first object. That is, the second object can make corresponding reactions to the interaction of the first object. The physical manifestation of the second object is usually affected by the interaction of the first object and changes accordingly. Exemplarily, when the second object is water surface, the flow rate usually changes due to the influence of the interaction of the first object, resulting in corresponding water splashes in the area affected by shelling, changes in the water body scattering effect, flowing foam, and ripples in the area where the mecha passes; when the second object is the ground, indentations will be produced on the ground where the mecha passes; when the second object is vegetation, the vegetation will collapse in the area where the mecha passes; and the spread of combustion will occur in the area hit by the shell.
[0047] Step 106: Determine the attribute information of the first object in the initial rendering texture, and calculate the state information of the second object based on the attribute information to obtain the target rendering texture.
[0048] In practical applications, on the basis of determining the interaction space with the target object as the coordinate origin, creating the initial rendering texture corresponding to the interaction space, and determining the first object and the second object in the interaction space, the attribute information of the first object in the initial rendering texture can be determined, and the state information of the second object can be calculated based on the attribute information to obtain the target rendering texture.
[0049] Specifically, the attribute information can characterize the physical attributes of the target object, such as the coordinate position, speed, gravity parameter, etc. in the initial rendering texture. The state information can be understood as the information used to change the original state of the second object when it is interacted with by the first object and affected by the first object. The target rendering texture refers to the image data texture finally obtained after a series of calculations and processes, which is used to present content such as the state information of the second object, and can also be understood as a set of image data for rendering display, containing various visual-related information such as the color, lighting, and material of the objects in the scene.
[0050] In an optional embodiment of the present specification, determining the attribute information of the first object in the initial rendering texture may include the following steps: Convert the current frame position of the first object in the target map into the target current frame position in the interaction space, and determine the target previous frame position of the first object; Determine the attribute information of the first object in the initial rendering texture according to the object type, target current frame position, and target previous frame position of the first object.
[0051] In practical applications, on the basis of determining the interaction space with the target object as the coordinate origin, the position information of each first object in the interaction space can be converted into the position information in the coordinate system of the interaction space, so as to obtain the position information relative to the target object.
[0052] Specifically, the current frame position of the first object in the target map can be understood as the position information of the first object in the coordinate system of the target map at the current frame. The target current frame position can be understood as the position information of the first object in the coordinate system of the interaction space at the current frame. That is to say, the target current frame position is the position of the first object relative to the target object. The target previous frame position can be understood as the position information of the first object in the coordinate system of the interaction space at the previous frame of the current frame. The target previous frame position is also the position of the first object relative to the target object; specifically, it refers to the position of the first object relative to the target object in the previous frame.
[0053] Optionally, the target previous frame position of the first object can be determined according to the initial rendering texture corresponding to the previous frame.
[0054] Optionally, determining the attribute information of the first object in the initial rendering texture according to the object type, target current frame position, and target previous frame position of the first object may include: Determine the object size and gravity parameter of the first object according to the object type of the first object; Obtain the speed of the first object according to the difference between the target current frame position and the target previous frame position.
[0055] Specifically, the object type can be understood as the type of the first object, which may specifically include different types such as bullets, shells, and mechas. The object size can be understood as the size of the first object. The gravity parameter can be understood as the weight of the first object.
[0056] Optionally, different size and gravity parameters can be set for different types of first objects in advance according to the requirements in practical applications (such as the desired artistic effect). Thus, the object size and gravity parameter corresponding to the first object can be matched according to the object type of the first object.
[0057] Specifically, the attribute information can be understood as the physical information of the first object, including object size, gravity parameter, and velocity. Among them, the velocity can be understood as the difference in the positions of the first object in the current frame and the previous frame. The velocity is relative to the target object.
[0058] Applying this embodiment, by determining the attribute information of the first object in the initial rendering texture according to the object type of the first object, the target current frame position, and the target previous frame position, the physical information of the first object that can interact with the map scene can be calculated and recorded in the initial rendering texture. Thus, based on the initial rendering texture, subsequent solving processes can be further performed to achieve the interactive calculation of the GPU, and thus the interactive effect generated by the first object on the second object can be rendered and displayed in the interactive area.
[0059] According to an optional embodiment of this specification, calculating the state information of the second object based on the attribute information to obtain the target rendering texture may include the following steps: Determine the influence information exerted by the first object on the second object according to the attribute information; Based on the influence information, perform physical calculation on the second object to obtain the state information of the second object; Add the state information to the initial rendering texture to obtain the target rendering texture.
[0060] Specifically, the influence information can be understood as the information exerted by the first object on the second object, and specifically may include information such as flow field integration, pressure, etc. The influence information can affect the physical performance of the second object. The state information can be understood as the calculation result obtained after performing physical calculation on the second object, or can also be understood as the information characterizing the physical performance of the second object. The target rendering texture can be understood as the rendering texture obtained after recording the calculation result in the initial rendering texture.
[0061] Optionally, through the state information, the physical performance of the second object can be simulated. Exemplarily, when the second object is water surface, the state information may include the vector information of the flow field; through the vector information of the flow field, the flowing effect of the water surface and the turbidity effect of the sediment under the water surface, etc. can be simulated.
[0062] Applying this embodiment, by determining the influence information exerted by the first object on the second object according to the attribute information; based on the influence information, performing physical calculation on the second object to obtain the state information of the second object, the physical performance of the second object after being interactively affected by the first object can be simulated through physical calculation based on the influence information exerted by the first object on the second object, realizing the interactive calculation of the GPU and the rendering of the interactive effect.
[0063] In practical applications, the first object that has an interactive impact on the second object can include one or more. Exemplarily, when a mecha moves on the water surface and fires a shell at a certain water surface area within the interactive space, the first object can include two types of objects: the mecha and the shell. Moreover, the type and quantity of the shells can also include one or more.
[0064] According to an optional embodiment of this specification, the attribute information includes the object size, gravity parameter, and speed of the first object, and the first object includes at least one; based on the attribute information, determining the impact information exerted by the first object on the second object can include the following steps: Based on the object size of the target first object, determine the corresponding interactive area, where the interactive area is the area on the second object that is affected by the interaction of the target first object, and the target first object is any one of the first objects; Based on the gravity parameter and speed of the target first object, calculate the initial impact information exerted by the target first object on the interactive area; Based on the initial impact information of each interactive area, obtain the impact information exerted by the first object on the second object.
[0065] Optionally, based on the object size of the target first object, determining the corresponding interactive area can include: Based on the target current frame position and object size of the target first object, determine the corresponding interactive area of the target first object.
[0066] Specifically, the interactive area can be understood as the area on the second object that is affected by the interaction of the target first object. The target first object is any one of the at least one first objects.
[0067] Optionally, in the target rendering texture, the interactive area is drawn in the form of a relatively simple geometric body. Exemplarily, it can be a circle.
[0068] In the case where there are multiple first objects, each first object will correspond to an interactive area. Since the gravity parameters and speeds of different first objects can be different, the initial impact information of different interactive areas can be different.
[0069] Specifically, the initial impact information can be understood as the force exerted by the first object on the interactive area. The initial impact information can include vector information and scalar information, where the vector information is used to control the direction of the force, and the scalar information is used to control the magnitude of the force.
[0070] In practical applications, when there are multiple first objects, the initial influence information applied to different interaction regions by each first object is calculated separately, and then the initial influence information of each interaction region is accumulated on the same image to obtain the influence information exerted by the first object on the second object.
[0071] Applying this embodiment, by calculating the initial influence information exerted by the target first object on the interaction region according to the gravity parameter and velocity of the target first object, the initial influence information corresponding to each interaction region can be calculated based on the gravity parameter and velocity of each first object; by obtaining the influence information exerted by the first object on the second object according to the initial influence information of each interaction region, the initial influence information of each interaction region can be accumulated in the same graph, so that the overall calculation can be performed once in the subsequent calculation process, improving the calculation efficiency.
[0072] According to an optional embodiment of this specification, based on the influence information, performing physical calculation on the second object to obtain the state information of the second object may include the following steps: Calling a shader program to perform physical calculation on each interaction region in parallel based on the initial influence information of each interaction region to obtain the state information of the second object.
[0073] Optionally, the shader program can be written according to the physical calculation tasks to be executed, and the specific writing method can be determined according to the requirements in practical applications. The shader program can be executed in parallel by the computing units in the GPU. The physical calculation tasks can specifically include: fluid calculation, diffusion calculation of flames, calculation of whether vegetation is crushed, etc., which can be specifically determined according to the calculations to be actually performed.
[0074] Optionally, when there are multiple first objects, a shader program can be called to perform physical calculation on each interaction region in parallel based on the initial influence information of each interaction region, so as to obtain the state information of the second object based on the calculation results corresponding to each interaction region.
[0075] It is easy to understand that since the attribute information such as the gravity parameter and velocity of different first objects is different, the interaction effects generated in different interaction regions also vary.
[0076] Applying this embodiment, by calling a shader program to perform physical calculation on each interaction region in parallel based on the initial influence information of each interaction region to obtain the state information of the second object, the physical calculation of the second object can be realized, and GPU interactive calculation can be realized. Moreover, through the parallel calculation method, the overall calculation of the interaction region can be realized through one calculation process, thus effectively improving the calculation efficiency.
[0077] Step 108: Render and display the interaction effect on the second object based on the target rendering texture.
[0078] In practical applications, when the target rendering texture is obtained, the interaction effect can be rendered and displayed on the second object based on the target rendering texture.
[0079] Specifically, the interaction effect can be understood as the influence effect exerted on the second object after the interaction between the first object and the second object, including the water splash ripples generated on the water surface, the sediment at the bottom of the water being stirred, the vegetation catching fire, the vegetation collapsing, the indentation generated on the road surface, and so on.
[0080] According to an optional embodiment of this specification, the state information includes flow velocity information; the second object includes the water surface; the interaction effect includes a scattering effect; rendering and displaying the interaction effect on the second object based on the target rendering texture may include the following steps: Sample the flow velocity information in the target rendering texture to obtain a flow velocity map; Based on the flow velocity map, adjust the scattering effect of the water surface and render and display the adjusted scattering effect.
[0081] Specifically, the flow velocity map refers to a rendering texture obtained by sampling the vector information of the water surface based on the target rendering texture.
[0082] Furthermore, the flow velocity map can be understood as splitting the water surface in the interaction space into many small water molecules. At this moment, for a water molecule at a certain point, it shows where it will move in the next moment. It can also be understood that the flow velocity map includes the vector information and pixel information for each vertex in the water surface model. Among them, the vector information for each vertex can include the moving distance and moving direction of the vertex in the next moment. The pixel information can include image information such as foam that can move with the water flow.
[0083] Specifically, the scattering effect can be understood as an effect obtained based on the lighting model, which can be manifested as the color of impurities under the water surface, thereby simulating the turbidity of the water body. Exemplarily, the water color of the Yellow River can be manifested as opaque yellow.
[0084] In practical applications, during the process of the target object running across the water surface, impurities under the water surface, such as sediment, will be affected by the interaction and show a stirred effect. Therefore, in order to simulate the stirring of impurities in the water body, it can be achieved by affecting the scattering effect.
[0085] Optionally, by making the scattering effect stronger, the water body can look more opaque and turbid, thereby simulating the effect of impurities in the water body being stirred.
[0086] Furthermore, through the flow velocity map, it is possible to determine the water surface area where the stirred effect occurs and the water flow direction in the water surface area. Thereby, it has an impact on the scattering effect.
[0087] Optionally, different colors can also be generated under different media through a lighting model.
[0088] Applying this embodiment can affect the scattering effect of water through a flow velocity map and generate different colors under different media through a lighting model, thereby simulating the effect of sediment stirring generated when the target object moves across the water surface, achieving the rendering of the interaction effect on the water surface, and achieving a more vivid and realistic rendering effect.
[0089] According to another optional embodiment of this specification, the interaction effect can also include a foam flow effect; after sampling the flow velocity information in the target rendering texture to obtain a flow velocity map, the following steps can also be included: Determine a foam mask map on the water surface; Based on the flow velocity map, drive the foam mask map and render and display the foam flow effect.
[0090] Optionally, determining a foam mask map on the water surface can include: Determine the area where foam is generated according to the movement trajectory of the target object on the water surface; Based on the area where foam is generated, obtain the foam mask map.
[0091] Specifically, the foam mask map is used to indicate the area where foam is generated in the water surface area. The movement trajectory of the target object on the water surface can be understood as the position where foam is generated.
[0092] Applying this embodiment, through the flow velocity map, the foam mask map can be driven, so that the foam can move along with the flow of water, and when the object moves across the water surface, a foam flow effect is generated on the water surface.
[0093] According to still another optional embodiment of this specification, the interaction effect can also include a ripple effect; after sampling the flow velocity information in the target rendering texture to obtain a flow velocity map, the following steps can also be included: Based on the flow velocity map, determine the height information and normal information of each vertex in the water surface model corresponding to the water surface; Render and display the ripple effect according to the height information and normal information.
[0094] Specifically, the ripple effect can be understood as the uneven undulating effect of the water surface.
[0095] In practical applications, during the process of the target object moving across the water surface, it can also affect the water surface, causing the water surface to exhibit a ripple effect. The height information can be obtained based on the flow velocity map, and the normal information can be calculated by calling the shader program, so that based on the height information and normal information, the ripple effect is rendered and displayed at the interaction area on the water surface.
[0096] Applying this embodiment, through the flow velocity map, the height information and normal information of each vertex of the water surface model can also be calculated, so that a ripple effect can be rendered on the water surface.
[0097] An embodiment of this specification provides a rendering method for interaction effects. In a target map, an interaction space with the target object as the coordinate origin is determined, and an initial rendering texture corresponding to the interaction space is created; based on the interaction event triggered by the target object, the first object and the second object in the interaction space are determined, where the first object is the object that interacts with the second object and generates an interaction effect on the second object; the attribute information of the first object in the initial rendering texture is determined, and based on the attribute information, the state information of the second object is calculated to obtain the target rendering texture; based on the target rendering texture, the interaction effect is rendered and displayed on the second object.
[0098] In this way, by determining the interaction space with the target object as the coordinate origin in the target map, the first object and the second object can both be transformed into the coordinate system corresponding to the interaction space, so that a rendering texture that follows the movement of the target object can be created, and the size of the rendering texture can be reasonably restricted to avoid affecting the system performance; by calculating the state information of the second object according to the attribute information, it is possible to simulate the interaction effect of the first object on the second object based on the target rendering texture at any position in the target map and achieve real-time rendering of the interaction effect, thereby obtaining a more realistic visual effect.
[0099] The following combines the attached Figure 2 , taking the application of the rendering method for interaction effects provided in this specification in fluid simulation as an example, to further illustrate the rendering method for interaction effects. Among them, Figure 2 FIG. shows the processing flowchart of a rendering method for interaction effects provided by an embodiment of this specification, which specifically includes the following steps.
[0100] Step 202: Determine the interaction space with the currently operated mecha as the spatial coordinate origin.
[0101] Step 204: Determine other interactive objects in the interaction space and transfer other interactive objects into the coordinate system corresponding to the interaction space.
[0102] Step 206: Create an RT corresponding to the interaction space, and determine the physical information of other interactive objects in the RT according to the relative relationship between other interactive objects and the currently operated mecha.
[0103] Specifically, the physical information may include the size information, gravity parameter, and speed of other interactive objects. Among them, the size information and gravity parameter can be preset by the art staff based on the requirements in actual applications; the speed is calculated according to the difference in the positions of the object between the current frame and the previous frame.
[0104] Step 208: Calculate the integral of the flow velocity field exerted by each other interaction object on the water surface according to the gravity parameter and velocity, and accumulate the integrals of the flow velocity fields to obtain the pressure field exerted by each interaction object in the interaction area on the overall water surface.
[0105] In practical applications, based on the interaction events triggered by the mecha, different physical calculations can be performed on the physical information through the ComputerShader to obtain the calculation results, and according to the calculation results, the interaction effects for the scene can be realized. Exemplarily, different physical calculations can include fluid calculation, diffusion calculation of flames, calculation of whether vegetation is crushed, and so on. The realized interaction effects can include: when the mecha rushes into the pool, water splashes will appear on the water surface, and the water splashes will spread along with the movement trajectory. After a shell or a bullet hits the water surface, water splashes will also be created and spread out; when the mecha uses a shell to hit the vegetation, the vegetation will catch fire, and the charred range will gradually expand over time; when the mecha passes through the vegetation or a tree, it can push down the tree in the current advancing direction; when the mecha walks on the terrain, indentations of the mecha can be left, and so on.
[0106] For fluid calculation, the viscous force simplified equation of the Navier - Stokes equation: the Euler equation can be used for GPU simulation. Interaction objects such as bullets, shelling, and the mecha operated by the player are regarded as circles in a 2D plane, and different interaction objects have different corresponding sizes. Based on the initial information corresponding to the sizes, the area affecting the water surface is determined. Further, by calculating the velocity and gravity parameter of each interaction object one by one, the integral of the flow velocity field exerted by each interaction object on the water surface is obtained. And by accumulating the integral of the flow velocity field in a graph, the pressure field exerted by each interaction object in the interaction area on the overall water surface is obtained.
[0107] Step 210: Based on the pressure field exerted on the overall water surface, call the ComputerShader to solve the Poisson equation to obtain the calculation result of the fluid.
[0108] In practical applications, the process of solving the Poisson equation can include: first, solving the divergence through the flow velocity, then solving the pressure, and finally solving the velocity field of the next moment, and performing advection on the initial circular area corresponding to the interaction object through the velocity field of the next moment.
[0109] Step 212: Record the calculation result in the RT and sample a flow velocity map for the RT.
[0110] Step 214: Through the flow velocity map, realize the rendering of the interaction effects generated by the interaction object on the water surface.
[0111] In practical applications, various interaction effects can be achieved through the flow velocity map. Exemplarily, when the mecha passes over the water surface, it can stir up the dust underwater, thereby affecting the scattering effect of the water body; when the mecha passes over the water surface, it can create foam based on the information of the fluid and drive the texture (flowMap) of the foam through the flow velocity map, making the texture flow; when the mecha passes over the water surface, through the flow velocity map, the calculated information can also be converted to height, and the normal line can be solved through the height, thereby causing ripples on the water surface.
[0112] Applying this embodiment, by determining the interaction space with the currently operated mecha as the origin of the spatial coordinates, the interaction objects within the interaction space can be converted into the interaction space by means of spatial transposition with the currently operated mecha as the center, so that a rendering texture of appropriate size can be created based on the interaction space. No matter where the mecha moves, scene interaction can be achieved through the rendering texture based on GPU calculation. Further, through fluid simulation, the interaction impact of the interaction object on the water surface can be calculated, and the corresponding interaction effect can be rendered on the water surface within the interaction space, realizing real-time calculation and rendering of the interaction effect. In addition, in addition to fluid simulation, other types of physical calculations can also be determined according to the interaction events triggered by the mecha in the scene, and other interaction effects can be realized.
[0113] Corresponding to the above method embodiment, this specification also provides an embodiment of a rendering device for interaction effects. Figure 3 The structural schematic diagram of a rendering device for interaction effects provided by an embodiment of this specification is shown. As Figure 3 shown, the device includes: Creation module 302: configured to determine an interaction space with the target object as the origin of coordinates in the target map and create an initial rendering texture corresponding to the interaction space.
[0114] Determination module 304: configured to determine a first object and a second object in the interaction space based on the interaction event triggered by the target object, where the first object is the object that interacts with the second object and generates an interaction effect on the second object.
[0115] Calculation module 306: configured to determine the attribute information of the first object in the initial rendering texture and calculate the state information of the second object according to the attribute information to obtain the target rendering texture.
[0116] Rendering module 308: configured to render and display the interaction effect on the second object based on the target rendering texture.
[0117] Optionally, the creation module 302 is further configured to: Determine the current frame position of the target object in the target map as the origin of coordinates; Determine an interaction space with the target object as the coordinate origin according to the preset spatial dimensions.
[0118] Optionally, the calculation module 306 is further configured to: Convert the current frame position of the first object in the target map to the target current frame position in the interaction space, and determine the target previous frame position of the first object; Determine the attribute information of the first object in the initial rendering texture according to the object type, target current frame position, and target previous frame position of the first object.
[0119] Optionally, the calculation module 306 is further configured to: Determine the influence information exerted by the first object on the second object according to the attribute information; Perform a physical calculation on the second object based on the influence information to obtain the state information of the second object; Add the state information to the initial rendering texture to obtain the target rendering texture.
[0120] Optionally, the attribute information includes the object size, gravity parameter, and speed of the first object, and the first object includes at least one; the calculation module 306 is further configured to: Determine the interaction area corresponding to the target first object according to the object size of the target first object, where the interaction area is the area on the second object affected by the interaction of the target first object, and the target first object is any one of the first objects; Calculate the initial influence information exerted by the target first object on the interaction area according to the gravity parameter and speed of the target first object; Obtain the influence information exerted by the first object on the second object according to the initial influence information of each interaction area.
[0121] Optionally, the calculation module 306 is further configured to: Call a shader program to perform a physical calculation on each interaction area in parallel based on the initial influence information of each interaction area to obtain the state information of the second object.
[0122] Optionally, the state information includes flow velocity information; the second object includes a water surface; the interaction effect includes a scattering effect; the rendering module 308 is further configured to: Sample the flow velocity information in the target rendering texture to obtain a flow velocity map; Adjust the scattering effect of the water surface based on the flow velocity map and render and display the adjusted scattering effect.
[0123] Optionally, the interaction effect further includes a foam flow effect; the rendering module 308 is further configured to: Determine a foam mask map on the water surface; Based on the flow velocity map, drive the foam mask map and render and display the foam flow effect.
[0124] Optionally, the interaction effect further includes a ripple effect; the rendering module 308 is further configured to: Based on the flow velocity map, determine the height information and normal information of each vertex in the water surface model corresponding to the water surface; Render and display the ripple effect according to the height information and normal information.
[0125] Applying this embodiment, by determining the interaction space with the target object as the coordinate origin in the target map, the first object and the second object can both be transformed into the coordinate system corresponding to the interaction space, so that a rendering texture that follows the movement of the target object can be created, and the size of the rendering texture can be reasonably restricted to avoid affecting the system performance; by calculating the state information of the second object according to the attribute information, it is possible to simulate the interaction effect of the first object on the second object based on the target rendering texture at any position in the target map and achieve real-time rendering of the interaction effect, thereby obtaining a more realistic visual effect.
[0126] The above is a schematic solution of a rendering device for an interaction effect in this embodiment. It should be noted that the technical solution of the rendering device for the interaction effect belongs to the same concept as the technical solution of the above-mentioned rendering method for the interaction effect. For the details not described in the technical solution of the rendering device for the interaction effect, reference can be made to the description of the technical solution of the above-mentioned rendering method for the interaction effect.
[0127] Figure 4 The structural block diagram of a computing device 400 provided according to an embodiment of this specification is shown. The components of the computing device 400 include but are not limited to a memory 410 and a processor 420. The processor 420 is connected to the memory 410 through a bus 430, and a database 450 is used to store data.
[0128] The computing device 400 also includes an access device 440, which enables the computing device 400 to communicate via one or more networks 460. Examples of such networks include the Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 440 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.
[0129] In one embodiment of the present specification, the above components of the computing device 400, as well as Figure 4 other components not shown, may also be connected to each other, for example, via a bus. It should be understood that Figure 4 the block diagram of the computing device shown is for illustrative purposes only and is not a limitation on the scope of the present specification. Those skilled in the art may add or replace other components as needed.
[0130] The computing device 400 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 smartphone), a wearable computing device (e.g., a smartwatch, 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 400 may also be a mobile or stationary server.
[0131] Among them, the processor 420 is used to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the rendering method with the above interaction effects.
[0132] The above is a schematic solution of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above-described rendering method for interaction effects belong to the same concept. For the details not described in detail in the technical solution of the computing device, reference can be made to the description of the technical solution of the above-described rendering method for interaction effects.
[0133] An embodiment of this specification also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the steps of the above-described rendering method for interaction effects are implemented.
[0134] The above is a schematic solution of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the above-described rendering method for interaction effects belong to the same concept. For the details not described in detail in the technical solution of the storage medium, reference can be made to the description of the technical solution of the above-described rendering method for interaction effects.
[0135] An embodiment of this specification also provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of the above-described rendering method for interaction effects are implemented.
[0136] The above is a schematic solution of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the above-described rendering method for interaction effects belong to the same concept. For the details not described in detail in the technical solution of the computer program product, reference can be made to the description of the technical solution of the above-described rendering method for interaction effects.
[0137] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0138] The computer instructions include computer program code, which may be in the form of source code, object code, 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), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0139] It should be noted that for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of this specification are not limited by the described action sequence, because according to the embodiments of this specification, some steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this specification.
[0140] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0141] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not elaborate on all the details, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can understand and utilize this specification well. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A method for rendering interactive effects, characterized in that: include: In the target map, an interactive space with the target object as the coordinate origin is determined, and an initial rendering texture corresponding to the interactive space is created; Determining a first object and a second object in the interactive space based on an interactive event triggered by the target object, wherein the first object is an object that interacts with the second object and produces an interactive effect on the second object; Determine attribute information of the first object in the initial rendering texture, and calculate state information of the second object according to the attribute information to obtain a target rendering texture; The interactive effect is rendered and displayed on the second object based on the target rendering texture.
2. The method according to claim 1, characterized in that Determining the interactive space with the target object as the coordinate origin in the target map includes: Determine the current frame position of the target object in the target map as the coordinate origin; According to a preset space size, an interactive space with the target object as a coordinate origin is determined.
3. The method according to claim 1, characterized in that The determining the attribute information of the first object in the initial rendering texture includes: Converting the current frame position of the first object in the target map to the target current frame position in the interactive space, and determining the target previous frame position of the first object; Determine attribute information of the first object in the initial rendering texture according to the object type of the first object, the target current frame position, and the target previous frame position.
4. The method according to claim 1, characterized in that The step of calculating the state information of the second object according to the attribute information to obtain a target rendering texture includes: Determining, according to the attribute information, information on the influence exerted by the first object on the second object; Based on the impact information, physically solve the second object to obtain state information of the second object; The state information is added to the initial rendering texture to obtain a target rendering texture.
5. The method according to claim 4, characterized in that The attribute information includes an object size, a gravity parameter, and a speed of the first object, the first object including at least one; The determining, according to the attribute information, the influence information exerted by the first object on the second object includes: Determine, according to the object size of the target first object, an interactive area corresponding to the target first object, wherein the interactive area is an area on the second object that is interactively affected by the target first object, and the target first object is any one of the first objects; Calculating initial impact information exerted by the target first object on the interaction area according to the gravity parameter and speed of the target first object; According to the initial influence information of each interaction area, influence information exerted by the first object on the second object is obtained.
6. The method according to claim 5, characterized in that The performing physical calculation on the second object based on the impact information to obtain the state information of the second object includes: A shader program is called to perform physical calculations on the interaction areas in parallel based on the initial impact information of the interaction areas to obtain the state information of the second object.
7. The method according to claim 1, characterized in that The state information includes flow rate information; the second object includes a water surface; the interaction effect includes a scattering effect; The rendering and displaying the interactive effect on the second object based on the target rendering texture includes: Sampling the flow rate information in the target rendering texture to obtain a flow rate map; Based on the flow velocity map, the scattering effect of the water surface is adjusted, and the adjusted scattering effect is rendered and displayed.
8. The method according to claim 7, characterized in that The interactive effect also includes a foam flow effect; After sampling the flow rate information in the target rendering texture to obtain a flow rate map, the method further includes: determining a foam mask map on the water surface; Based on the flow velocity map, the foam mask map is driven, and the foam flow effect is rendered and displayed.
9. The method according to claim 7, characterized in that: The interactive effect also includes a ripple effect; After sampling the flow rate information in the target rendering texture to obtain a flow rate map, the method further includes: Based on the flow velocity map, determining height information and normal information of each vertex in a water surface model corresponding to the water surface; The ripple effect is rendered and displayed according to the height information and the normal information.
10. A rendering device for interactive effects, characterized in that: include: A creation module is configured to determine, in a target map, an interactive space with a target object as a coordinate origin, and create an initial rendering texture corresponding to the interactive space; a determination module configured to determine a first object and a second object in the interaction space based on the interaction event triggered by the target object, wherein the first object is an object that interacts with the second object and produces an interaction effect on the second object; a calculation module configured to determine attribute information of the first object in the initial rendering texture, and calculate state information of the second object according to the attribute information to obtain a target rendering texture; A rendering module is configured to render and display the interaction effect on the second object based on the target rendering texture.
11. 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 program / instructions are executed by the processor, the steps of the method for rendering the interactive effects described in any one of claims 1 to 9 are implemented.
12. 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 method for rendering the interactive effect described in any one of claims 1 to 9.
13. 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 method for rendering the interactive effect as described in any one of claims 1 to 9.