Model surface liquid flow effect rendering method and device and electronic equipment

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

Patent Information

Application Number
CN202211246098.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-12
Publication Date
2026-09-25
Estimated Expiration
2042-10-12

AI Technical Summary

Technical Problem

相关技术中,通常会在游戏角色的受伤部位放置三维粒子,模拟渲染受伤后喷血的效果,首先三维粒子的渲染效果较为粗糙,其次,在真实的人类场景中,很少会有受伤后喷血的场面,所以该种方式的渲染效果缺乏写实感和真实感

Benefits of technology

[0009]本发明提供了一种模型表面液体流动效果的渲染方法、装置和电子设备,获取目标模型的基础材质;其中,基础材质上叠加有预先创建的目标贴图,目标贴图的贴图纹理与基础材质的材质纹理相同;响应于目标模型被击中,确定目标模型的被击中位置的UV坐标;从预先生成的轨迹贴图中获取目标轨迹贴图;其中,轨迹贴图包括液体的流动轨迹;根据UV坐标,在目标贴图中叠加目标轨迹贴图中的流动轨迹,得到液体流动贴图;基于液体流动贴图和基础材质,以渲染显示模型表面的液体流动效果。该方式中,预先在基础材质中设置目标贴图,在模型被击中后,将目标轨迹贴图中的流动轨迹叠加至目标贴图的被击中位置,得到液体流动贴图,最后通过渲染液体流动贴图中的流动轨迹,在目标模型表面实现液体流动的效果,提高了液体流动效果的细腻度,提高了渲染效果的写实感和真实感。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115880401B_ABST
    Figure CN115880401B_ABST
Patent Text Reader

Abstract

The application provides a rendering method and device for liquid flow effect on a model surface and an electronic device. A base material of a target model is obtained. The base material is superimposed with a target map. In response to the target model being hit, a UV coordinate of a hit position of the target model is determined. A target trajectory map is obtained from a pre-generated trajectory map. A flow trajectory in the target trajectory map is superimposed in the target map according to the UV coordinate to obtain a liquid flow map. The liquid flow effect on the model surface is rendered based on the liquid flow map and the base material. In this way, the target map is pre-set in the base material. After the model is hit, the flow trajectory in the target trajectory map is superimposed at the hit position of the target map to obtain the liquid flow map. The liquid flow effect on the target model surface is realized by rendering the liquid flow map. The delicacy of the liquid flow effect is improved, and the realistic and authentic feeling of the rendering effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of model rendering technology, and in particular to a rendering method, apparatus, and electronic device for creating a liquid flow effect on a model surface. Background Technology

[0002] In some current games, when a game character is injured (such as being hit), there is generally no realistic blood flow effect at the site of the injury. Related technologies typically place 3D particles at the injured area to simulate the effect of spurting blood. However, firstly, the rendering effect of 3D particles is relatively rough; secondly, in real human scenarios, there are rarely scenes of blood spurting after an injury. Therefore, this method of rendering lacks realism and a sense of realism. Summary of the Invention

[0003] In view of this, the purpose of the present invention is to provide a rendering method, apparatus and electronic device for the liquid flow effect on the surface of a model, so that the liquid can flow along the surface of the model, the liquid flow effect is more delicate, and the realism and lifelikeness of the rendering effect are improved.

[0004] In a first aspect, embodiments of the present invention provide a rendering method for a liquid flow effect on a model surface. The method includes: obtaining a base material of a target model; wherein a pre-created target texture is superimposed on the base material, and the texture of the target texture is the same as the texture of the base material; in response to the target model being hit, determining the UV coordinates of the hit position of the target model; obtaining a target trajectory texture from a pre-generated trajectory texture; wherein the trajectory texture includes the flow trajectory of the liquid; superimposing the flow trajectory in the target trajectory texture on the target texture according to the UV coordinates to obtain a liquid flow texture; and rendering and displaying a liquid flow effect on the model surface based on the liquid flow texture and the base material.

[0005] Secondly, embodiments of the present invention provide a rendering apparatus for a liquid flow effect on a model surface. The apparatus includes: an acquisition module for acquiring the base material of a target model; wherein a pre-created target texture is superimposed on the base material, and the texture of the target texture is the same as the texture of the base material; a coordinate determination module for determining the UV coordinates of the hit position of the target model in response to the target model being hit; a texture acquisition module for acquiring a target trajectory texture from a pre-generated trajectory texture; wherein the trajectory texture includes the flow trajectory of the liquid; a trajectory superimposition module for superimposing the flow trajectory in the target trajectory texture on the target texture according to the UV coordinates to obtain a liquid flow texture; and a model rendering module for rendering and displaying the liquid flow effect on the model surface based on the liquid flow texture and the base material.

[0006] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the rendering method for the liquid flow effect on the model surface of any one of the first aspects.

[0007] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the rendering method for the liquid flow effect on the model surface of any one of the first aspects.

[0008] The embodiments of the present invention bring the following beneficial effects:

[0009] This invention provides a rendering method, apparatus, and electronic device for creating a liquid flow effect on a model surface. The method involves obtaining the base material of the target model; a pre-created target texture is superimposed on the base material, and the texture of the target texture is identical to that of the base material; in response to the target model being hit, the UV coordinates of the hit position are determined; a target trajectory texture is obtained from a pre-generated trajectory texture; the trajectory texture includes the liquid flow trajectory; based on the UV coordinates, the flow trajectory from the target trajectory texture is superimposed on the target texture to obtain a liquid flow texture; and based on the liquid flow texture and the base material, the liquid flow effect on the model surface is rendered. In this method, a target texture is pre-set in the base material; after the model is hit, the flow trajectory from the target trajectory texture is superimposed on the hit position of the target texture to obtain the liquid flow texture; finally, by rendering the flow trajectory in the liquid flow texture, a liquid flow effect is achieved on the target model surface, improving the fineness of the liquid flow effect and enhancing the realism and lifelikeness of the rendering.

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

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

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

[0013] Figure 1 A flowchart illustrating a method for rendering liquid flow effects on a model surface, provided in an embodiment of the present invention;

[0014] Figure 2 A schematic diagram of a target model provided in an embodiment of the present invention;

[0015] Figure 3 A schematic diagram of a trajectory mapping provided in an embodiment of the present invention;

[0016] Figure 4 This is a schematic diagram of a liquid flow mapping provided in an embodiment of the present invention;

[0017] Figure 5 A schematic diagram of the structure of a rendering device for the effect of liquid flow on a model surface provided in an embodiment of the present invention;

[0018] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

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

[0020] In some current games, when a game character is injured (e.g., hit), realistic blood flow effects are generally not displayed at the site of the injury. Related technologies typically place 3D particles at the injured area to simulate the effect of blood spurting out after an injury; for example, when a game character is hit by a bullet, blood spurts out at the point of impact. However, firstly, the rendering effect of 3D particles is relatively rough; secondly, in real human scenarios, scenes of blood spurting out after an injury are rare, so this method lacks realism and a sense of realism. Therefore, this invention provides a method, apparatus, and electronic device for rendering liquid flow effects on a model surface. This technology can be applied to electronic devices such as computers and laptops.

[0021] To facilitate understanding of this embodiment, a detailed description of a rendering method for a liquid flow effect on a model surface disclosed in this embodiment of the invention will be provided first, such as... Figure 1 As shown, the method includes the following steps:

[0022] Step S102: Obtain the base material of the target model; wherein, a pre-created target texture is superimposed on the base material, and the texture of the target texture is the same as the material texture of the base material;

[0023] The target model mentioned above is a 3D model, typically referring to a virtual model in a game scene, such as a virtual character or animal. The base material mentioned above usually refers to PBR (Physics-Based Rendering) material, which is currently a mainstream technology in the field of 3D rendering. The target texture mentioned above can also be called an RT_MergeBlood texture. This target texture is overlaid on the base material of the target model, and its texture is the same as the texture of the base material. For example, if the base material of the target model has a skin texture, then the target texture will also have a skin texture. The target texture mentioned above is mainly used to add and store the flow trajectory of liquids.

[0024] Step S104: In response to the target model being hit, determine the UV coordinates of the hit location of the target model;

[0025] The UV coordinates of the hit location in the target model's UV space can be determined based on the world coordinates of the hit location. The target model can be hit by a weapon, another virtual character, or by a skill, such as being hit by a bullet, cut by a knife, burned, or hit by a car. The world coordinates refer to coordinates in the world coordinate system, which is a reference coordinate system chosen in the environment to describe the position of the camera and objects. Therefore, after detecting a hit on the target model, the world coordinates of the hit location can be directly determined based on the world coordinate system.

[0026] Furthermore, the UV space of the target model refers to the two-dimensional representation of a three-dimensional model. For example, if a cube is unfolded along its edges, the box is then tiled onto a two-dimensional plane. The shape of this unfolded box is called the UV space. After drawing a pattern on this two-dimensional plane, the model is folded back into the box, and all the patterns are now in three-dimensional space. This embodiment works similarly. After the target model is unfolded and tiled onto a two-dimensional plane according to certain rules, the desired pattern is drawn on this two-dimensional plane. Therefore, after determining the world coordinates of the hit location, and unfolding the target model to obtain the UV space, the UV coordinates of the hit location can be directly determined in the two-dimensional plane using the UV coordinate system.

[0027] In practice, if a target model is detected to have been hit, the `FindCollisionUV` function can be used to calculate the position of the hit location on the UV plane (i.e., the UV space mentioned above), which is the UV coordinate. For example, ... Figure 2 As shown, the target model is a virtual character, and the location where it is hit is... Figure 2 The location is given, and its UV coordinates in UV space, i.e., the UV plane, are calculated using the FindCollisionUV function based on the world coordinates of that location.

[0028] Additionally, it should be noted that the above steps can also be implemented as follows: if liquid flow or stains occur at a specified location on the target model, the UV coordinates of the specified location in the UV space of the target model can be determined based on the world coordinates of the specified location.

[0029] Step S106: Obtain the target trajectory map from the pre-generated trajectory map; wherein, the trajectory map includes the flow trajectory of the liquid;

[0030] The pre-generated trajectory maps mentioned above can be one or more. If there are multiple maps, the liquid flow trajectory in each trajectory map is usually different. The target trajectory maps mentioned above can also be one or more, usually determined by the number of times the target model is hit or the number of hit locations. For example, one target trajectory map can be obtained if the target model is hit once, and two target trajectory maps can be obtained if it is hit twice.

[0031] For example, such as Figure 3 As shown in the image, the white area represents the liquid's flow path, while the black area can be the same as the texture map on the target model's surface, or it can be transparent. If multiple pre-generated trajectory maps are included, such as... Figure 3 As shown, the flow trajectory is different in each trajectory map. It should be noted that... Figure 3 The examples illustrate three flow trajectories, but in actual project applications, there will be many more pre-generated flow trajectories.

[0032] In practice, when a target model is detected to be hit, a target trajectory map matching the current hit scene can be obtained from the pre-generated trajectory map according to the map's identifier, or a target trajectory map can be randomly obtained from the trajectory map. Furthermore, these pre-generated trajectory maps are typically stored in a designated storage space, such as in an array, for later use.

[0033] In one possible approach, pre-generated trajectory maps carry map identifiers to match the impact scene. For example, being hit by a bullet corresponds to a map identifier of "1", being hit by a knife wound corresponds to a map identifier of "2", being wet corresponds to a map identifier of "3", and so on. Therefore, in actual implementation, a target trajectory map matching the weapon used to hit the target model can be obtained from the trajectory map.

[0034] Step S108: Based on the UV coordinates, the flow trajectory in the target trajectory map is superimposed on the target texture map to obtain the liquid flow map;

[0035] Target trajectory maps can be overlaid onto target maps at the corresponding UV coordinates. The flow direction of the flow trajectory in the placed target trajectory map must match the actual scene to ensure the liquid flows downwards. If multiple target trajectory maps are included, overlaying the flow trajectories from each target trajectory map allows for the simultaneous display of multiple flow trajectories. In practical applications, if multiple locations on the target model are hit, to ensure that flow trajectories are displayed at all hit locations, target maps need to be pre-set. The purpose is to allow the corresponding flow trajectories to be displayed sequentially at the hit locations according to the hit time when multiple locations on the target model are hit. For example,... Figure 4 The liquid flow map shown includes multiple flow paths.

[0036] Step S110: Based on the liquid flow map and base material, render the liquid flow effect on the surface of the model.

[0037] The liquid used for the liquid flow effect can be a preset liquid color, such as red, yellow, or black, and can be set according to actual needs. If the liquid is blood, the liquid color will be red; if the liquid is a stain, the liquid color will be gray or black, etc. The material texture of the target model's base material can be set according to the type of the target model. For example, if the target model is a human, the material texture of the base material will be the human's skin; if the target model is an animal, the material texture of the base material will be the animal's fur.

[0038] In practice, the flow trajectory in the liquid flow texture can be rendered and displayed based on the target parameters. Steps S108 and S110 are executed simultaneously; that is, while the flow trajectory is superimposed on the target texture to obtain the liquid flow texture, this liquid flow texture is simultaneously rendered and displayed on the target model, so that the surface of the target model can produce a liquid flow effect. Furthermore, the above rendering method can be a rendering method based on realistic physical properties, referring to a collection of rendering techniques that, to varying degrees, are based on fundamental theories more consistent with the physical principles of the real world. Specifically, the rendering and display method can be to control the flow trajectory to gradually appear in the base material through the target parameters, thereby creating a liquid flow effect on the model surface.

[0039] This invention provides a method for rendering a liquid flow effect on a model surface. The method involves obtaining the base material of the target model; a pre-created target texture is superimposed on the base material, and the texture of the target texture is the same as the texture of the base material; in response to the target model being hit, the UV coordinates of the hit position of the target model are determined; a target trajectory texture is obtained from a pre-generated trajectory texture; the trajectory texture includes the liquid flow trajectory; based on the UV coordinates, the flow trajectory in the target trajectory texture is superimposed on the target texture to obtain a liquid flow texture; and based on the liquid flow texture and the base material, the liquid flow effect on the model surface is rendered. In this method, a target texture is pre-set in the base material; after the model is hit, the flow trajectory in the target trajectory texture is superimposed on the hit position of the target texture to obtain the liquid flow texture; finally, by rendering the flow trajectory in the liquid flow texture, the liquid flow effect on the target model surface is achieved, improving the fineness of the liquid flow effect and enhancing the realism and lifelikeness of the rendering effect.

[0040] To further improve rendering efficiency and quality, the pre-generated trajectory maps include multiple maps, each depicting a different liquid flow trajectory. Specifically, multiple trajectory maps with different flow trajectories can be pre-generated, for example, such as... Figure 3 As shown, each flow trajectory is different. Specifically, multiple trajectory maps with different liquid flow degrees, flow rates, and trajectory lengths can be pre-generated. The degree of liquid flow, flow rate, and trajectory length are programmatically controllable, enabling the programmatic generation of various liquid flow trajectories and thus rendering a variety of different liquid flow effects. This method, by pre-generating multiple trajectory maps with different flow trajectories, can render a variety of different liquid flow effects, further improving the rendering quality.

[0041] Furthermore, the number of target trajectory maps is the same as the number of times the target model is hit. If a target model is detected to be hit, a target trajectory map is immediately acquired; if the target model is detected to be hit again, another target trajectory map is acquired, the purpose of which is to make the hit effect more realistic.

[0042] The following describes step S106, which involves overlaying the flow trajectory from the target trajectory map onto the target texture map based on the UV coordinates to obtain a liquid flow map. One possible implementation is as follows:

[0043] (1) Determine the target position corresponding to the UV coordinates from the target texture; wherein, the position in the target texture corresponds to the coordinate position in the UV space of the target model;

[0044] (2) Overlay the flow trajectory in the target trajectory map onto the target position of the target map to obtain a liquid flow map; wherein, the liquid flow map includes at least one flow trajectory.

[0045] A pre-created first material can be used to overlay the flow trajectory from the target trajectory map onto the target texture. This first material, also known as the flow trajectory merging material (M_Merge), can be configured in the material editor by changing the blending mode to Additive overlay mode. This allows different flow trajectories to be superimposed, primarily used to render the effect of multiple bleeding points on a target model after repeated attacks. The parameters for the first material include at least the `uv_offset` and `blood_shape` parameters. The `uv_offset` parameter is used to pass or retrieve the UV coordinates. After calculating the UV coordinates using the `FindCollisionUV` function, these coordinates are passed to the `uv_offset` parameter to determine the target position corresponding to the UV coordinates from the target texture using the first material. The `blood_shape` parameter is used to pass or retrieve the target trajectory map; that is, after retrieving the target trajectory map, it is passed to the `blood_shape` parameter.

[0046] The aforementioned target texture, also known as the RT_MergeBlood texture, is pre-created to store target trajectory textures for subsequent rendering of the target model and to display the liquid flow effect. To ensure the target trajectory texture superimposed on the target texture is applied to the hit location, the target texture is mapped one-to-one with its UV coordinates. This allows the superimposed target texture to be directly rendered and displayed on the target model's surface based on the UV space. This method, by storing multiple flow trajectories from the superimposed target trajectory texture, enables the simultaneous display of multiple liquid flow trajectories, further enhancing the realism of the liquid flow effect.

[0047] In step (2) above, the step of superimposing the flow trajectory from the target trajectory map onto the target position of the target map to obtain the liquid flow map can be implemented in one possible way:

[0048] The flow trajectory from the target trajectory texture is overlaid at the target location of the target texture, and a preset liquid color is drawn in the trajectory area of ​​the flow trajectory to obtain the liquid flow texture.

[0049] The preset liquid color can be red, yellow, black, etc., and can be set according to the actual scene requirements. If the liquid is blood, the liquid color is red; if the liquid is a stain, the liquid color is gray or black, etc. In other words, while overlaying the flow trajectory from the target trajectory map onto the target location of the target texture, a preset liquid color is passed in to control the trajectory area of ​​the flow trajectory in the target texture to draw the preset liquid color, thus obtaining the liquid flow texture. Taking bleeding from a human body surface as an example, such as... Figure 4 The liquid flow texture shown depicts bloodstains in the flow path and normal human skin in gray areas. The liquid flow effect is further enhanced by adding liquid color.

[0050] In step S110 above, the step of rendering and displaying the liquid flow effect on the surface of the model based on the liquid flow map and the base material, one possible implementation is as follows:

[0051] Based on preset target parameters, the flow trajectory of the liquid flow map is displayed in the base material to obtain the liquid flow effect on the model surface; where the target parameters are used to simulate the liquid flow effect on the model surface.

[0052] The aforementioned target parameter can be the flow parameter set in the first material, used to simulate the slow flow of liquid. The target trajectory map can be overlaid on the target position of the target map using the uv_offset parameter, and then the flow trajectory in the target trajectory map is gradually displayed based on the flow parameter. Specifically, starting from the target position, the flow trajectory in the target trajectory map is rendered and gradually displayed in the direction indicated by the liquid flow direction, according to the liquid flow speed indicated by the target parameter, so that the liquid flow effect gradually appears on the model surface from the target position (i.e., the impact position). In this method, by controlling the display of the liquid flow map through preset target parameters, a liquid flow effect can be produced on the model surface, further improving the realism of the liquid flow.

[0053] The aforementioned target parameters include: movement speed and flow direction; the step of displaying the flow trajectory of the liquid flow map in the base material according to the preset target parameters to obtain the liquid flow effect on the model surface, is implemented in one possible way:

[0054] A preset mask texture is superimposed on the flow trajectory of the liquid flow texture; the texture of the mask texture is the same as that of the target texture; the mask texture is moved in the direction of flow according to the movement speed to display the flow trajectory of the liquid flow texture in the base material, so as to obtain the liquid flow effect on the surface of the model.

[0055] Specifically, within a preset timeframe after the target model is hit, the flow speed of the liquid can be controlled based on the movement speed, i.e., the movement speed of the mask texture, thereby controlling the display area of ​​the flow trajectory. After the flow trajectory is superimposed on the target texture, a mask texture is also superimposed. Then, the mask texture is controlled to move in the flow direction to gradually display the flow trajectory of the liquid flow texture on the surface of the target model, thus obtaining the liquid flow effect on the model surface.

[0056] Alternatively, the target parameter can be set to a display value that varies. For example, the value can range from 0 to 1. Or, the target parameter can be essentially a percentage of the flow trajectory; 0 indicates no flow trajectory is displayed, 1 indicates the flow trajectory is fully displayed, and intermediate values ​​provide a transition. For instance, at 0.1, 10% of the flow trajectory is displayed starting from the target location and moving in the direction indicated by the texture map of the liquid flow direction.

[0057] In practice, the `DrawMaterial to Render Target` function can be used to display the flow trajectory on the model surface. The principle is similar to covering a book with an A4 sheet of paper; as the paper moves downwards, the text on the book gradually appears. `flow` describes this process of the A4 sheet moving.

[0058] The aforementioned base material is a pre-assigned material to the target model. Within this material, a liquid flow texture can be used as a mask parameter to display the liquid flow effect on the model's surface. Specifically, if the target model is a human, the model material is the skin material; if the target model is an animal, the model material is the fur material. This base material is typically a PBR material. Setting material parameters within the model material primarily aims to create a dynamic liquid flow effect within the model material, enabling the model material to function as a liquid flow element.

[0059] The aforementioned control method displays a liquid flow map on the surface of the target model, applying this map to the model's diffuse, normal, and roughness properties to ensure correct PBR lighting after the liquid flows. This method, by rendering the liquid flow map within the model's material, achieves the function of creating liquid flow within the base material, allowing the liquid flow to blend better with the material and further improving the rendering effect.

[0060] To further enhance the realism of liquid flow effects, one possible implementation of the step described above—obtaining the target trajectory map from a pre-generated trajectory map—is to randomly obtain the target trajectory map from the pre-generated trajectory map. This reduces repetition and better reflects real-world conditions.

[0061] Furthermore, prior to the step of determining the UV coordinates of the hit location of the target model in response to being hit, the method further includes: acquiring a weapon model, determining whether the weapon model interacts with a model in the game scene; and if the weapon model interacts with the target model, determining that the target model has been hit.

[0062] The aforementioned weapon models can be virtual knives, virtual bullets, virtual vehicles, or even virtual human figures such as feet and hands. In other words, any virtual model that can serve as a weapon can be one of these weapon models. In practical implementation, raycasting can be used, with the weapon model as the starting point, to determine whether there is interaction between the model in the scene and the weapon model. If the weapon model interacts with the target model, it is determined that the target model has been hit.

[0063] Specifically, in actual gameplay, the interaction between weapon models and target models can be detected in real time. For example, using a raycasting method, a ray can be set in the 3D scene from the weapon model's perspective, along the line of sight. This ray can hit any object in the scene, and the ray can also detect which target models will bleed after being hit. When the ray interacts with a model in the scene, it is determined that the model has been hit.

[0064] Furthermore, in response to the target model being hit, the step of determining the UV coordinates of the hit position of the target model can be implemented as follows: in response to the target model being hit, determine the interaction position between the target model and the weapon model, and determine the interaction position as the hit position of the target model; determine the UV coordinates of the hit position of the target model based on the UV of the target model.

[0065] The aforementioned method further enhances the rendering of characters taking damage in the gaming industry, mapping bleeding effects to the pixel level, rather than simply displaying a crude effect of spurting blood particles at the point of impact. This makes the game's presentation more realistic.

[0066] Corresponding to the above method embodiments, this invention provides a rendering device for the liquid flow effect on a model surface, such as... Figure 5 As shown, the device includes:

[0067] The material acquisition module 51 is used to acquire the base material of the target model; wherein, a pre-created target texture is superimposed on the base material, and the texture of the target texture is the same as the material texture of the base material;

[0068] The coordinate determination module 52 is used to determine the UV coordinates of the hit position of the target model in response to the target model being hit.

[0069] The texture acquisition module 53 is used to acquire a target trajectory texture from a pre-generated trajectory texture; wherein, the trajectory texture includes the flow trajectory of the liquid;

[0070] The trajectory overlay module 54 is used to overlay the flow trajectory in the target trajectory map onto the target map according to the UV coordinates to obtain a liquid flow map;

[0071] Model rendering module 55 is used to render and display the liquid flow effect on the surface of the model based on liquid flow maps and base materials.

[0072] This invention provides a rendering apparatus for a liquid flow effect on a model surface. The apparatus obtains the base material of the target model; a pre-created target texture is superimposed on the base material, and the texture of the target texture is the same as the texture of the base material; in response to the target model being hit, the UV coordinates of the hit position of the target model are determined; a target trajectory texture is obtained from a pre-generated trajectory texture; the trajectory texture includes the liquid flow trajectory; based on the UV coordinates, the flow trajectory in the target trajectory texture is superimposed on the target texture to obtain a liquid flow texture; based on the liquid flow texture and the base material, the liquid flow effect on the model surface is rendered and displayed. In this method, a target texture is pre-set in the base material; after the model is hit, the flow trajectory in the target trajectory texture is superimposed on the hit position of the target texture to obtain the liquid flow texture; finally, by rendering the flow trajectory in the liquid flow texture, the liquid flow effect on the target model surface is achieved, improving the fineness of the liquid flow effect and enhancing the realism and lifelikeness of the rendering effect.

[0073] The pre-generated trajectory maps mentioned above include multiple maps, each with a different flow trajectory.

[0074] The number of target trajectory maps mentioned above is the same as the number of times the target model is hit.

[0075] The aforementioned trajectory overlay module is also used to: determine the target position corresponding to the UV coordinates from the target texture; wherein the position in the target texture corresponds to the coordinate position in the UV space of the target model; overlay the flow trajectory in the target trajectory texture at the target position in the target texture to obtain a liquid flow texture; wherein the liquid flow texture includes at least one flow trajectory.

[0076] The aforementioned trajectory overlay module is also used to: overlay the flow trajectory in the target trajectory map at the target position of the target map, and draw a preset liquid color in the trajectory area of ​​the flow trajectory to obtain a liquid flow map.

[0077] The aforementioned model rendering module is also used to: display the flow trajectory of the liquid flow map in the base material according to the preset target parameters, so as to obtain the liquid flow effect on the model surface; wherein, the target parameters are used to simulate the liquid flow effect on the model surface.

[0078] The target parameters mentioned above include: movement speed and flow direction; the model rendering module is also used to: overlay a preset mask map on the flow trajectory in the liquid flow map; wherein, the texture of the mask map is the same as the texture of the target map; according to the movement speed, the mask map is moved in the flow direction to display the flow trajectory in the liquid flow map in the base material, so as to obtain the liquid flow effect on the model surface.

[0079] The aforementioned texture acquisition module is also used to: randomly acquire a target trajectory texture from a pre-generated trajectory texture.

[0080] The aforementioned device further includes a hit determination module, used to: acquire a weapon model, determine whether the weapon model interacts with a model in the game scene; if the weapon model interacts with a target model, determine that the target model has been hit.

[0081] The aforementioned coordinate determination module is also used to: in response to the target model being hit, determine the interaction position between the target model and the weapon model, and determine the interaction position as the hit position of the target model; and determine the UV coordinates of the hit position of the target model based on the UV of the target model.

[0082] The rendering device for liquid flow effect on model surface provided in this embodiment of the invention has the same technical features as the rendering method for liquid flow effect on model surface provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

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

[0084] See Figure 6 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the rendering method of the above-mentioned liquid flow effect on the model surface.

[0085] Furthermore, Figure 6 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.

[0086] The memory 101 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

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

[0088] The process involves: acquiring the base material of the target model; overlaying a pre-created target texture on the base material, with the target texture having the same texture as the base material; determining the UV coordinates of the hit location in response to the target model being hit; acquiring the target trajectory texture from a pre-generated trajectory texture, which includes the flow trajectory of the liquid; overlaying the flow trajectory from the target trajectory texture onto the target texture based on the UV coordinates to obtain the liquid flow texture; and rendering the liquid flow effect on the model's surface based on the liquid flow texture and the base material. In this method, a target texture is pre-set in the base material. After the model is hit, the flow trajectory from the target trajectory texture is overlaid onto the hit location of the target texture to obtain the liquid flow texture. Finally, by rendering the flow trajectory from the liquid flow texture, the liquid flow effect is achieved on the target model's surface, improving the smoothness of the liquid flow effect and enhancing the realism and vividness of the rendering.

[0089] The pre-generated trajectory maps mentioned above include multiple maps, each depicting a different liquid flow trajectory. This method, by pre-generating multiple trajectory maps with varying flow trajectories, allows for the rendering of diverse liquid flow effects, further enhancing the rendering quality.

[0090] The number of target trajectory maps mentioned above is the same as the number of times the target model is hit.

[0091] The above-described steps, which involve overlaying a flow trajectory from a target trajectory map onto a target texture map based on UV coordinates to obtain a liquid flow texture, include: determining the target position corresponding to the UV coordinates in the target texture map; wherein the position in the target texture map corresponds to the coordinate position in the UV space of the target model; and overlaying the flow trajectory from the target trajectory map onto the target position in the target texture map to obtain the liquid flow texture map; wherein the liquid flow texture map includes at least one flow trajectory. In this method, by overlaying the flow trajectory from the target trajectory map onto the target texture map, multiple flow trajectories can be stored simultaneously, enabling the simultaneous display of multiple liquid flow trajectories and further improving the realism of the liquid flow effect.

[0092] The steps described above for overlaying the flow trajectory from the target trajectory map onto the target location of the target texture to obtain a liquid flow texture include: overlaying the flow trajectory from the target trajectory map onto the target location of the target texture, and drawing a preset liquid color within the trajectory area of ​​the flow trajectory to obtain the liquid flow texture. By drawing the liquid color, the liquid flow effect is further enhanced.

[0093] The above steps for rendering and displaying the liquid flow effect on the model surface based on liquid flow maps and base materials include: displaying the flow trajectory of the liquid flow map in the base material according to preset target parameters to obtain the liquid flow effect on the model surface; wherein, the target parameters are used to simulate the liquid flow effect on the model surface. In this method, by controlling the display of the liquid flow map through preset target parameters, a liquid flow effect can be generated on the model surface, further improving the realism of the liquid flow.

[0094] The aforementioned target parameters include: movement speed and flow direction. The steps for displaying the flow trajectory of the liquid flow map in the base material according to the preset target parameters to obtain the liquid flow effect on the model surface include: overlaying a preset mask map on the flow trajectory of the liquid flow map; wherein the texture of the mask map is the same as the texture of the target map; and moving the mask map in the flow direction according to the movement speed to display the flow trajectory of the liquid flow map in the base material, thereby obtaining the liquid flow effect on the model surface. In this method, by rendering and displaying the liquid flow map in the model material, the function of creating liquid flow within the base material is realized, allowing the liquid flow to blend better with the material and further improving the rendering effect.

[0095] The steps described above for obtaining the target trajectory map from the pre-generated trajectory map include: randomly obtaining the target trajectory map from the pre-generated trajectory map. This reduces the repetition of the flow trajectory and makes it more realistic.

[0096] Before the step of determining the UV coordinates of the hit position of the target model in response to the target model being hit, the method further includes: acquiring a weapon model and determining whether the weapon model interacts with the model in the game scene; if the weapon model interacts with the target model, determining that the target model has been hit.

[0097] The above-mentioned step of determining the UV coordinates of the hit position of the target model in response to the target model being hit includes: determining the interaction position between the target model and the weapon model in response to the target model being hit, and determining the interaction position as the hit position of the target model; and determining the UV coordinates of the hit position of the target model based on the UV of the target model.

[0098] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When these machine-executable instructions are invoked and executed by a processor, they cause the processor to implement the rendering method for the above-mentioned liquid flow effect on the model surface, specifically including:

[0099] The process involves: acquiring the base material of the target model; overlaying a pre-created target texture on the base material, with the target texture having the same texture as the base material; determining the UV coordinates of the hit location in response to the target model being hit; acquiring the target trajectory texture from a pre-generated trajectory texture, which includes the flow trajectory of the liquid; overlaying the flow trajectory from the target trajectory texture onto the target texture based on the UV coordinates to obtain the liquid flow texture; and rendering the liquid flow effect on the model's surface based on the liquid flow texture and the base material. In this method, a target texture is pre-set in the base material. After the model is hit, the flow trajectory from the target trajectory texture is overlaid onto the hit location of the target texture to obtain the liquid flow texture. Finally, by rendering the flow trajectory from the liquid flow texture, the liquid flow effect is achieved on the target model's surface, improving the smoothness of the liquid flow effect and enhancing the realism and vividness of the rendering.

[0100] The pre-generated trajectory maps mentioned above include multiple maps, each depicting a different liquid flow trajectory. This method, by pre-generating multiple trajectory maps with varying flow trajectories, allows for the rendering of diverse liquid flow effects, further enhancing the rendering quality.

[0101] The number of target trajectory maps mentioned above is the same as the number of times the target model is hit.

[0102] The above-described steps, which involve overlaying a flow trajectory from a target trajectory map onto a target texture map based on UV coordinates to obtain a liquid flow texture, include: determining the target position corresponding to the UV coordinates in the target texture map; wherein the position in the target texture map corresponds to the coordinate position in the UV space of the target model; and overlaying the flow trajectory from the target trajectory map onto the target position in the target texture map to obtain the liquid flow texture map; wherein the liquid flow texture map includes at least one flow trajectory. In this method, by overlaying the flow trajectory from the target trajectory map onto the target texture map, multiple flow trajectories can be stored simultaneously, enabling the simultaneous display of multiple liquid flow trajectories and further improving the realism of the liquid flow effect.

[0103] The steps described above for overlaying the flow trajectory from the target trajectory map onto the target location of the target texture to obtain a liquid flow texture include: overlaying the flow trajectory from the target trajectory map onto the target location of the target texture, and drawing a preset liquid color within the trajectory area of ​​the flow trajectory to obtain the liquid flow texture. By drawing the liquid color, the liquid flow effect is further enhanced.

[0104] The above steps for rendering and displaying the liquid flow effect on the model surface based on liquid flow maps and base materials include: displaying the flow trajectory of the liquid flow map in the base material according to preset target parameters to obtain the liquid flow effect on the model surface; wherein, the target parameters are used to simulate the liquid flow effect on the model surface. In this method, by controlling the display of the liquid flow map through preset target parameters, a liquid flow effect can be generated on the model surface, further improving the realism of the liquid flow.

[0105] The aforementioned target parameters include: movement speed and flow direction. The steps for displaying the flow trajectory of the liquid flow map in the base material according to the preset target parameters to obtain the liquid flow effect on the model surface include: overlaying a preset mask map on the flow trajectory of the liquid flow map; wherein the texture of the mask map is the same as the texture of the target map; and moving the mask map in the flow direction according to the movement speed to display the flow trajectory of the liquid flow map in the base material, thereby obtaining the liquid flow effect on the model surface. In this method, by rendering and displaying the liquid flow map in the model material, the function of creating liquid flow within the base material is realized, allowing the liquid flow to blend better with the material and further improving the rendering effect.

[0106] The steps described above for obtaining the target trajectory map from the pre-generated trajectory map include: randomly obtaining the target trajectory map from the pre-generated trajectory map. This reduces the repetition of the flow trajectory and makes it more realistic.

[0107] Before the step of determining the UV coordinates of the hit position of the target model in response to the target model being hit, the method further includes: acquiring a weapon model and determining whether the weapon model interacts with the model in the game scene; if the weapon model interacts with the target model, determining that the target model has been hit.

[0108] The above-mentioned step of determining the UV coordinates of the hit position of the target model in response to the target model being hit includes: determining the interaction position between the target model and the weapon model in response to the target model being hit, and determining the interaction position as the hit position of the target model; and determining the UV coordinates of the hit position of the target model based on the UV of the target model.

[0109] The computer program product of the rendering method, apparatus, electronic device and system for liquid flow effect on model surface provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

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

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

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

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

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

Claims

1. A method for rendering liquid flow effects on a model surface, characterized in that, The method includes: Obtain the base material of the target model; wherein, a pre-created target texture is superimposed on the base material, and the texture of the target texture is the same as the material texture of the base material; In response to the target model being hit, determine the UV coordinates of the hit location of the target model; Obtain the target trajectory map from a pre-generated trajectory map; wherein, the trajectory map includes the flow trajectory of the liquid; Based on the UV coordinates, the flow trajectory in the target trajectory map is superimposed on the target map to obtain a liquid flow map; A preset mask texture is superimposed on the flow trajectory in the liquid flow texture; wherein the texture of the mask texture is the same as the texture of the target texture. The mask map is moved at a preset speed and in a preset flow direction to display the flow trajectory of the liquid flow map in the base material, thereby obtaining the liquid flow effect on the surface of the model.

2. The method according to claim 1, characterized in that, The pre-generated trajectory maps include multiple maps, and the flow trajectory of the liquid is different in each trajectory map.

3. The method according to claim 1, characterized in that, The number of target trajectory maps is the same as the number of times the target model is hit.

4. The method according to claim 1, characterized in that, The step of obtaining a liquid flow map by overlaying the flow trajectory from the target trajectory map onto the target map based on the UV coordinates includes: The target position corresponding to the UV coordinates is determined from the target texture; wherein the position in the target texture corresponds to the coordinate position in the UV space of the target model; The flow trajectory in the target trajectory texture is superimposed on the target location of the target texture to obtain the liquid flow texture; wherein, the liquid flow texture includes at least one flow trajectory.

5. The method according to claim 4, characterized in that, The step of overlaying the flow trajectory from the target trajectory texture onto the target location of the target texture to obtain the liquid flow texture includes: The flow trajectory from the target trajectory texture is superimposed on the target location of the target texture, and a preset liquid color is drawn in the trajectory area of ​​the flow trajectory to obtain the liquid flow texture.

6. The method according to claim 1, characterized in that, The steps for obtaining the target trajectory map from a pre-generated trajectory map include: The target trajectory map is randomly obtained from the pre-generated trajectory map.

7. The method according to claim 1, characterized in that, Prior to the step of determining the UV coordinates of the hit location of the target model in response to being hit, the method further includes: Obtain the weapon model and determine whether the weapon model interacts with the model in the game scene; If the weapon model interacts with the target model, it is determined that the target model has been hit.

8. The method according to claim 7, characterized in that, The step of determining the UV coordinates of the hit location of the target model in response to the target model being hit includes: In response to the target model being hit, the interaction position between the target model and the weapon model is determined, and the interaction position is determined as the hit position of the target model; Based on the UV of the target model, determine the UV coordinates of the hit location of the target model.

9. A rendering device for the liquid flow effect on a model surface, characterized in that, The device includes: The material acquisition module is used to acquire the base material of the target model; wherein, a pre-created target texture is superimposed on the base material, and the texture of the target texture is the same as the material texture of the base material; A coordinate determination module is used to determine the UV coordinates of the hit position of the target model in response to the target model being hit; The texture acquisition module is used to acquire a target trajectory texture from a pre-generated trajectory texture; wherein, the trajectory texture includes the flow trajectory of the liquid; The trajectory overlay module is used to overlay the flow trajectory in the target trajectory map onto the target map according to the UV coordinates to obtain a liquid flow map. The model rendering module is used to overlay a preset mask texture on the flow trajectory of the liquid flow texture; wherein the texture of the mask texture is the same as the texture of the target texture; the mask texture is moved in a preset flow direction at a preset moving speed to display the flow trajectory of the liquid flow texture in the base material, thereby obtaining the liquid flow effect on the surface of the model.

10. An electronic device, characterized in that, The system includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the rendering method for the liquid flow effect on the model surface as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the rendering method for the liquid flow effect on the model surface as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Rendering method of dynamic fluid effect and apparatus thereof

    CN106504311A

  • A method and device for realizing the virtual fluid in a three-dimensional space, a medium and an electronic device

    CN109887063A