Model surface liquid effect control method and device, equipment and storage medium
By acquiring and adjusting the liquid mask and surface subdivision multiplier, the problem of low efficiency in controlling liquid effects on subsurface scattering shading models is solved, achieving flexible control and efficient and realistic liquid effect rendering.
Patent Information
- Application Number
- CN202410487139.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-22
- Publication Date
- 2025-10-24
AI Technical Summary
Existing technologies cannot effectively control the liquid flow effect when rendering virtual object models of human figures, and the control efficiency is low, making it impossible to represent the droplet display effect on subsurface scattering shading models.
By acquiring the target liquid mask, overlaying a displacement map to obtain the first liquid mask, determining the raised area, increasing the surface subdivision multiplier in the raised area, and re-rendering the liquid effect.
It enables flexible control over the liquid effect on the subsurface scattering shading model, improving the control efficiency and realism of the liquid effect.
Smart Images

Figure CN120833424A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of three-dimensional modeling, in particular to a model surface liquid effect control method and device, equipment and storage medium. BACKGROUND
[0002] In the prior art, when a user needs to present a liquid effect on a model surface, if the liquid effect only involves a static droplet display effect (e.g., displaying water droplets on the model surface), a Clear Coat shading model can be used to produce the above-mentioned static droplet display effect (e.g., water droplet effect); if the liquid effect involves a dynamic liquid flow effect, a dynamic mask composed of multiple time sequence images can be used, wherein each time sequence image corresponds to an image frame of liquid flow over time, so that the above-mentioned dynamic mask is applied to the model surface, and the liquid flow effect can be presented on the model surface.
[0003] However, on the one hand, since the skin material of a character uses a subsurface scattering shading model, the above-mentioned Clear Coat shading model cannot be used to represent the droplet display effect when rendering a character virtual object model; on the other hand, the liquid flow effect presented on the model surface is determined by the playback effect of the time sequence images in the above-mentioned dynamic mask, and the traditional control method of modifying the time sequence images frame by frame is usually used in the prior art to adjust the liquid flow effect presented on the model surface, thereby resulting in low control efficiency of the liquid flow effect. SUMMARY
[0004] Therefore, the present application aims to provide a model surface liquid effect control method and device, equipment and storage medium, which supports presenting a liquid effect on multiple shading models such as a subsurface scattering shading model, so that the presentation of the liquid effect is not limited by the type of the shading model, and the liquid effect rendered and displayed on the model surface can be quickly and conveniently adjusted by modifying material attribute parameters such as a tessellation multiplier, thereby effectively improving the control efficiency of the liquid effect and the degree of realistic restoration of the liquid effect.
[0005] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the following describes a preferred embodiment in detail, and the accompanying drawings are referred to as follows.
[0006] In a first aspect, the present application provides a model surface liquid effect control method, which comprises:
[0007] obtaining a target liquid mask for rendering and displaying a liquid effect on a target model surface;
[0008] overlay a displacement map of the target liquid on the target liquid mask to obtain a first liquid mask, wherein the target liquid comprises static droplets and / or flowing liquid;
[0009] determine, from the target model rendered based on the first liquid mask, a raised area distributed on the surface of the target model under the condition that the target liquid mask is replaced by the first liquid mask;
[0010] increase a tessellation multiplier configured for the raised area to a first tessellation multiplier, and re-render a liquid effect of the surface of the target model according to the first liquid mask under the condition that the first tessellation multiplier is configured for the raised area.
[0011] In a second aspect, an embodiment of the present application provides a control device for a liquid effect of a model surface, and the control device comprises:
[0012] a obtaining module configured to obtain a target liquid mask used for rendering and displaying a liquid effect on a surface of a target model;
[0013] a mask making module configured to overlay a displacement map of a target liquid on the target liquid mask to obtain a first liquid mask, wherein the target liquid comprises static droplets and / or flowing liquid;
[0014] an adjusting module configured to determine, from the target model rendered based on the first liquid mask, a raised area distributed on the surface of the target model under the condition that the target liquid mask is replaced by the first liquid mask;
[0015] a rendering module configured to increase a tessellation multiplier configured for the raised area to a first tessellation multiplier, and re-render a liquid effect of the surface of the target model according to the first liquid mask under the condition that the first tessellation multiplier is configured for the raised area.
[0016] In a third aspect, an embodiment of the present application provides a computer device, which comprises a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements steps of the control method for a liquid effect of a model surface when executing the computer program.
[0017] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements steps of the control method for a liquid effect of a model surface when running on a processor.
[0018] The technical scheme provided by the embodiments of the present application can include the following beneficial effects:
[0019] The model surface liquid effect control method, device, equipment and storage medium provided by the embodiments of the present application can obtain a target liquid mask for rendering and displaying a liquid effect on a target model surface; superimpose a displacement map of a target liquid on the target liquid mask according to a target liquid corresponding to the target liquid mask, to obtain a first liquid mask; determine a convex region distributed on the target model surface from the target model rendered based on the first liquid mask, under the condition that the target liquid mask is replaced by the first liquid mask; increase a curved surface subdivision multiplier configured for the convex region to a first curved surface subdivision multiplier, and re-render and display the liquid effect on the target model surface according to the first liquid mask, under the condition that the first curved surface subdivision multiplier is configured for the convex region. In this way, the present application supports presenting the liquid effect on various shading models such as a subsurface scattering shading model, so that the presentation of the liquid effect is not limited by the type of the shading model, and the liquid effect rendered and displayed on the model surface can be quickly and conveniently adjusted by modifying material attribute parameters such as the curved surface subdivision multiplier, thereby effectively improving the control efficiency of the liquid effect and the degree of real restoration of the liquid effect. BRIEF DESCRIPTION OF DRAWINGS
[0020] In order to more clearly illustrate the technical scheme of the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor.
[0021] Figure 1 A flowchart of a model surface liquid effect control method provided by an embodiment of the present application is shown;
[0022] Figure 2a A flowchart of a method for making a displacement map of a static liquid drop provided by an embodiment of the present application is shown;
[0023] Figure 2b A flowchart of a method for making a displacement map of a flowing liquid provided by an embodiment of the present application is shown;
[0024] Figure 3a A flowchart of a method for generating a liquid drop mask provided by an embodiment of the present application is shown;
[0025] Figure 3b A flowchart of a method for generating a liquid drop mask provided by an embodiment of the present application is shown;
[0026] Figure 4aA flowchart of a method for generating a liquid flow mask is shown.
[0027] Figure 4b A flowchart of a method for generating a liquid flow mask is shown.
[0028] Figure 4c A flowchart of a method for generating a liquid flow mask is shown.
[0029] Figure 5 A flowchart of a method for generating a liquid flow mask is shown.
[0030] Figure 6 A flowchart of a method for generating a liquid flow mask is shown.
[0031] Figure 7a A flowchart of a method for generating a liquid flow mask is shown.
[0032] Figure 7b A flowchart of a method for generating a liquid flow mask is shown.
[0033] Figure 7c A flowchart of a method for generating a liquid flow mask is shown.
[0034] Figure 8 A flowchart of a method for generating a liquid flow mask is shown.
[0035] Figure 9 A flowchart of a method for generating a liquid flow mask is shown. DETAILED DESCRIPTION
[0036] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the following will be combined with the accompanying drawings for the embodiments of the present application to make a clear and complete description of the technical solutions in the embodiments of the present application. It should be understood that the accompanying drawings in the present application only serve the purpose of illustration and description, and do not serve to limit the protection scope of the present application. In addition, it should be understood that the accompanying drawings are not drawn according to the actual proportions. The flowchart in the present application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can not be implemented in sequence, and the steps without logical context relationship can be reversed in sequence or implemented simultaneously. In addition, one or more other operations can be added to the flowchart or one or more operations can be removed from the flowchart under the guidance of the content of the present application.
[0037] In addition, the described embodiments are only some embodiments of the present application, rather than all embodiments. The components of the embodiments of the present application described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0038] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0039] In the prior art, a liquid drop display effect of a model surface can be made using a transparent coating color model, and a dynamic mask composed of multiple time sequence images can be used to present a liquid flow effect on the model surface. However, on the one hand, since a subsurface scattering color model is used for a skin material of a character, the transparent coating color model cannot be used to present the liquid drop display effect when a character virtual object model is rendered. On the other hand, the liquid flow effect presented on the model surface is determined by the playing effect of the time sequence images in the dynamic mask, and the conventional control method of modifying the time sequence images frame by frame is usually used to adjust the liquid flow effect presented on the model surface, which results in a low control efficiency of the liquid flow effect.
[0040] Based on this, the embodiments of the present application provide a model surface liquid effect control method, device, equipment and storage medium, which supports presenting a liquid effect on multiple color models such as a subsurface scattering color model, so that the presentation of the liquid effect is not limited by the type of the color model, and the liquid effect rendered and displayed on the model surface can be quickly and conveniently adjusted by modifying material attribute parameters such as a tessellation multiplier, which effectively improves the control efficiency of the liquid effect and the real restoration degree of the liquid effect.
[0041] In one of the embodiments of the present application, the model surface liquid effect control method can be applied to a virtual engine capable of making three-dimensional dynamic effects, and the virtual engine can run on a terminal device or a server. The terminal device can be a local terminal device, and when the virtual engine runs on the server, the model surface liquid effect control method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device (i.e. a terminal device).
[0042] It should be noted that the specific type of the virtual engine is not limited in the embodiments of the present application. For example, the virtual engine can be a UE4 (Unreal Engine 4) engine for game production, or a UE5 (Unreal Engine 5) engine, etc.
[0043] To facilitate the understanding of the embodiments of the present application, a model surface liquid effect control method, device, equipment and storage medium provided by the embodiments of the present application are described in detail below.
[0044] Referring to Figure 1 , a flowchart of a model surface liquid effect control method provided by the embodiments of the present application is shown, wherein the control method comprises steps S101-S104; specifically: Figure 1
[0045] S101, a target liquid mask for rendering and displaying a liquid effect on a target model surface is obtained.
[0046] S102, a displacement map of a target liquid is superimposed on the target liquid mask according to the target liquid corresponding to the target liquid mask, to obtain a first liquid mask.
[0047] S103, under the condition that the target liquid mask is replaced by the first liquid mask, a convex region distributed on the target model surface is determined from the target model rendered based on the first liquid mask.
[0048] S104, the curved surface subdivision multiplier configured for the convex region is increased to a first curved surface subdivision multiplier, and under the condition that the first curved surface subdivision multiplier is configured for the convex region, the liquid effect on the target model surface is re-rendered and displayed according to the first liquid mask.
[0049] The method for controlling the liquid effect on the surface of the model provided in the embodiments of the present application comprises the following steps: obtaining a target liquid mask for rendering and displaying a liquid effect on the surface of a target model; superimposing a displacement map of a target liquid corresponding to the target liquid mask on the target liquid mask to obtain a first liquid mask; determining a convex region distributed on the surface of the target model from the target model after rendering based on the first liquid mask, under the condition that the target liquid mask is replaced by the first liquid mask; increasing a subdivision multiplier configured on the convex region to a first subdivision multiplier, and re-rendering and displaying the liquid effect on the surface of the target model according to the first liquid mask, under the condition that the first subdivision multiplier is configured on the convex region. In this way, the present application supports presenting the liquid effect on a plurality of shading models such as the subsurface scattering shading model, so that the presentation of the liquid effect is not limited by the type of the shading model, and the liquid effect rendered and displayed on the surface of the model can be quickly and conveniently adjusted by modifying the material attribute parameters such as the subdivision multiplier, thereby effectively improving the control efficiency of the liquid effect and the degree of real restoration of the liquid effect.
[0050] The steps in the method for controlling the liquid effect on the surface of the model provided in the embodiments of the present application will be described below.
[0051] In step S101, a target liquid mask for rendering and displaying a liquid effect on the surface of a target model is obtained.
[0052] In the optional embodiments of the present application, the target model can be an object model such as a glass model, a vase model, a water cup model, a plant model, an animal model such as a tiger model and a rabbit model, and a human model (including a human partial model such as a face model, a hand model, and a leg model) such as a game character model and a virtual person model, from the perspective of the appearance of the model. From the perspective of the type of the shading model to which the model belongs, the target model can be a plurality of different types of shading models such as a transparent coating shading model and a subsurface scattering shading model. The specific type of the target model is not limited in the embodiments of the present application.
[0053] Here, in step S101, the target liquid mask represents a mask originally used for rendering and displaying a liquid effect on the surface of the target model, that is, before step S101 is performed, the target model is rendered according to the target liquid mask, and the liquid effect can be rendered and displayed on the surface of the target model.
[0054] Optionally, the liquid effect can be a static liquid drop effect (e.g., a water drop, a sweat drop, or the like displayed on the surface of the target model), a dynamic liquid flow effect (e.g., a water flow, a sweat flow, or the like flowing on the surface of the target model), or a combination of the liquid drop effect and the liquid flow effect.
[0055] Optionally, the target liquid mask corresponding to the liquid effect can be a liquid drop mask for rendering the liquid drop effect on the surface of the target model (e.g., a water drop mask for rendering a water drop on the surface of the target model, a sweat drop mask for rendering a sweat drop on the surface of the target model, or the like), a liquid flow mask for rendering the liquid flow effect on the surface of the target model (e.g., a water flow mask for rendering a water flow on the surface of the target model, a sweat flow mask for rendering a sweat flow on the surface of the target model, or the like), or a composite mask for rendering the liquid drop effect and the liquid flow effect on the surface of the target model (in this case, the liquid drop mask and the liquid flow mask corresponding to the same target model are respectively generated, and then the liquid drop mask and the liquid flow mask are superimposed using an addition function to obtain the composite mask).
[0056] It should be noted that the target liquid mask is a black-and-white image, in which a white image region in the target liquid mask corresponds to a region on the surface of the target model where the liquid effect is displayed, and a black image region in the target liquid mask corresponds to a region on the surface of the target model where the liquid effect is not displayed. On this basis, when the target liquid mask is the composite mask, the addition function is used to superimpose the liquid drop mask and the liquid flow mask, and an additional constraint condition that the grayscale value at the same position is normalized to 0 (the grayscale value corresponding to black) and 1 (the grayscale value corresponding to white) is added to ensure the accuracy of the target liquid mask obtained after superimposition.
[0057] In S102, a displacement map of the target liquid corresponding to the target liquid mask is superimposed on the target liquid mask to obtain a first liquid mask.
[0058] Here, the specific liquid type to which the target liquid belongs can be determined according to the specific liquid effect rendered by the target liquid mask; wherein, referring to the related description of step S101, when the target liquid mask is the droplet mask, the target liquid can be a static droplet (such as a water droplet, a sweat droplet, etc.); when the target liquid mask is the liquid flow mask, the target liquid can be a flowing liquid (such as a water flow, a sweat flow, etc.); when the target liquid mask is the composite mask, the target liquid can be the static droplet and the flowing liquid; that is, in step S102, the target liquid includes the static droplet and / or the flowing liquid.
[0059] In an optional embodiment of the present application, in order to improve the realistic restoration degree of the liquid effect on the target model surface (for example, to make the liquid profile of the target liquid on the target model surface more realistic, and the highlight of the central region of the target liquid more realistic, etc.), more attention needs to be paid to the target liquid distributed on the raised region of the target model surface when rendering the target model (which is equivalent to the target liquid on the raised region of the target model surface after rendering, such as a static water droplet, a sweat droplet, or a liquid accumulation part in a water flow or a sweat flow, etc.). Therefore, in order to improve the attention degree to the target liquid distributed on the raised region of the model surface in subsequent model rendering, the part of the material attribute parameters related to the target liquid mask (mainly the subdivision multiplier) can be adjusted in combination with the displacement map and the subdivision technique of the target liquid, and the mesh on the raised region of the target model surface can be subdivided, so as to improve the surface detail richness of the raised region of the target model surface (that is, the attention degree to the raised region of the target model surface can be improved in subsequent model rendering).
[0060] Here, the Displacement Map (displacement map) is a special texture map, which is mainly used to replace and subdivide the original mesh of the model, change the original model from a physical level, and thus improve the surface details of the model. The Subdivision (subdivision) refers to reasonably dividing a face of a model into more small faces, so as to improve the model accuracy and improve the rendering effect, which will be used in combination with the above-mentioned displacement map. That is, in order to improve the surface detail richness of the raised region of the target model surface in combination with the subdivision technique subsequently, the displacement map of the target liquid needs to be superimposed on the basis of the original target liquid mask, so as to obtain the first liquid mask which can be used in combination with the subdivision technique in subsequent model rendering.
[0061] It should be noted that the specific making method of the displacement map is not unique, and the specific making method of the displacement map of the target liquid is not limited in the embodiments of the present application.
[0062] In an optional embodiment of the present application, when making the displacement map of the static droplet,Figure 2a FIG. 1 shows a schematic diagram of a process for producing a displacement map of a static droplet provided by an embodiment of the present application. Figure 2a As shown, a droplet map 201 of a static droplet can be first obtained (the droplet map 201 of the static droplet is required when producing the droplet mask included in the target liquid mask. Therefore, the droplet map 201 of the static droplet can be directly obtained from multiple basic production maps associated with the target liquid mask). The droplet map 201 includes multiple droplet images (i.e., multiple white image areas in the droplet map 201). By performing Gaussian blur processing on the droplet map 201, the droplet map 201 after Gaussian blur processing can be obtained as the displacement map 210 of the static droplet.
[0063] In an optional embodiment of the present application, when making a displacement map of a flowing liquid, Figure 2b FIG. 1 shows a flow chart of a method for producing a displacement map of a flowing liquid according to an embodiment of the present application. Figure 2b As shown, taking the target model as the virtual character model 200 as an example, the liquid distribution map 202 associated with the virtual character model 200 can be obtained first (when making the above-mentioned liquid flow mask included in the above-mentioned target liquid mask, the liquid distribution map 202 of the flowing liquid is required to be used. Therefore, the liquid distribution map 202 of the flowing liquid can be directly obtained from the multiple basic production maps associated with the above-mentioned target liquid mask). The liquid distribution map 202 includes multiple flowing liquids and flow channels corresponding to each flowing liquid (i.e., multiple white image areas in the liquid distribution map 202). When the liquid flow effect is rendered on the model surface of the virtual character model 200, each flowing liquid will flow in its corresponding flow channel; similar to the method of making the displacement map of the above-mentioned static droplet, by performing Gaussian blur processing on the liquid distribution map 202, the liquid distribution map 202 after Gaussian blur processing can be obtained as the displacement map 220 of the flowing liquid.
[0064] Specifically, when the target liquid is the above-mentioned static droplet, the displacement map of the target liquid is the displacement map of the static droplet, and the target liquid mask is the above-mentioned droplet mask; at this time, when executing step S102, the displacement map of the static droplet is multiplied by the above-mentioned droplet mask to obtain the above-mentioned first liquid mask corresponding to when the target liquid is the above-mentioned static droplet.
[0065] Specifically, when the target liquid is the above-mentioned flowing liquid, the displacement map of the target liquid is the displacement map of the flowing liquid, and the target liquid mask is the above-mentioned liquid flow mask; at this time, when executing step S102, the displacement map of the flowing liquid is multiplied by the above-mentioned liquid flow mask to obtain the above-mentioned first liquid mask corresponding to when the target liquid is the above-mentioned flowing liquid.
[0066] Specifically, when the target liquid is the static liquid drop and the flowing liquid, the replacement map of the target liquid includes: the replacement map of the static liquid drop and the replacement map of the flowing liquid, and the target liquid mask is the composite mask; at this time, when step S102 is performed, the target liquid mask can be multiplied with the replacement map of the static liquid drop and the replacement map of the flowing liquid respectively to obtain two to-be-processed masks, and then the two to-be-processed masks are mixed to obtain a mixed mask as the first liquid mask corresponding to the case that the target liquid is the static liquid drop and the flowing liquid.
[0067] S103, under the condition that the target liquid mask is replaced by the first liquid mask, determining a convex region distributed on the surface of the target model from the target model rendered based on the first liquid mask.
[0068] Here, after the target liquid mask is replaced by the first liquid mask, the first liquid mask can be used to re-render the target model and update the liquid effect displayed on the surface of the target model.
[0069] It should be noted that in step S103, the way to determine the convex region of the surface of the target model is not unique, and the specific determination method actually performed in step S103 is not limited in the embodiments of the present application.
[0070] Specifically, as an optional embodiment, considering that in the surface subdivision in the embodiments of the present application, the main concern is the liquid convex region on the surface of the target model (equivalent to ignoring the surface convex region of the target model itself, such as ignoring the mountain convex region of the surface of the terrain model itself), the static liquid drop region and / or the liquid aggregation region in the flowing liquid (i.e. the sweat aggregation part in the sweat stream, the water drop aggregation part in the water stream, etc.) can be directly screened from the first liquid mask according to the method described in steps a1-a2, wherein when the target model is rendered, the liquid convex region on the surface of the target model is displayed according to the static liquid drop region in the first liquid mask and / or the liquid aggregation region in the flowing liquid, so that the static liquid drop region and / or the liquid aggregation region in the flowing liquid on the corresponding rendering display region of the surface of the target model can be determined as the convex region in step S103.
[0071] Step a1, enhancing the image contrast of the first liquid mask by image enhancement to obtain the first liquid mask with enhanced image contrast.
[0072] It should be noted that the image enhancement manner capable of enhancing the image contrast of the first liquid mask is not unique, and the specific image enhancement manner adopted in step a1 is not limited in the embodiments of the present application.
[0073] Optionally, as an optional embodiment, since the first liquid mask is a gray-scale image, the image contrast of the first liquid mask can be enhanced by directly multiplying the first liquid mask by the first liquid mask; wherein the gray-scale value of the white image region in the first liquid mask is close to 1, and the gray-scale value of the black image region is close to 0, so that the black image region in the first liquid mask after multiplication will become darker (i.e. the gray-scale value will become smaller), and the white image region in the first liquid mask after multiplication will become whiter (i.e. the gray-scale value will become larger), thereby playing a role in enhancing the image contrast.
[0074] It should be noted that when the first liquid mask is multiplied by the first liquid mask to enhance the image contrast of the first liquid mask, the specific number of multiplications can be set according to the actual mask manufacturing requirements, and the embodiments of the present application are not limited in this regard.
[0075] Optionally, as another optional embodiment, since the first liquid mask is a gray-scale image, the image contrast of the first liquid mask can be enhanced by using power law (gamma) transformation; wherein when power law transformation is used, smaller gray-scale values will be mapped to smaller values (equivalent to the black image region in the first liquid mask before enhancement will become darker in the first liquid mask after enhancement), and larger gray-scale values will be mapped to larger values (equivalent to the white image region in the first liquid mask before enhancement will become whiter in the first liquid mask after enhancement).
[0076] Step a2, from the first liquid mask after image contrast enhancement, the local image region with a gray-scale value higher than or equal to a preset gray-scale threshold is selected, and the rendering display region corresponding to the target model surface of the local image region is determined as the protruding region.
[0077] Specifically, in the first liquid mask, the white image area corresponds to the area on the subsequent target model surface that displays the liquid effect described above (i.e., the distribution area of static droplets and / or flowing liquid), and the white image area also belongs to the image area with a higher gray value (i.e., higher than the black image area). Therefore, the area with a higher gray value (i.e., the area with a whiter color) has a higher probability of belonging to the liquid accumulation area on the subsequent target model surface (i.e., the display area of static droplets and / or the display area of the liquid accumulation part in the flowing liquid) (i.e., a higher probability of belonging to the protruding area), so that, after enhancing the image contrast of the first liquid mask, the local image area with a higher gray value (the gray value is higher than or equal to a preset gray threshold) can be screened from the first liquid mask with enhanced image contrast through gray value screening, and the rendering display area corresponding to the local image area on the target model surface is determined as the protruding area.
[0078] It should be noted that, when rendering the target model using the first liquid mask, since each pixel point in the first liquid mask corresponds to each position point on the target model surface, the rendering display area corresponding to the local image area on the target model surface can be determined based on the local image area in the first liquid mask, that is, the protruding area of the target model surface.
[0079] Specifically, as another optional embodiment, all protruding areas of the target model surface (equivalent to no longer distinguishing between the surface protruding area of the target model itself and the liquid protruding area formed on the target model surface due to the rendering of the target liquid mask) can also be determined directly from the rendered target model according to the method described in steps b1-b2 as follows:
[0080] Step b1, after rendering the target model based on the first liquid mask, for a grid point on the surface of the rendered target model, determining whether the grid point is distributed at an edge position of the target model surface according to the vector dot product result between the normal direction of the grid point and the camera perspective direction.
[0081] Here, for each grid point on the surface of the rendered target model, the vector dot product result between the normal direction of the grid point and the camera perspective direction can be calculated according to the Vertex Normal (vertex normal) normal direction of the grid point and the Camera Direction Vector camera perspective direction (which can also be replaced by the Camera Position camera position coordinates - World Position vertex world coordinates of the grid point).
[0082] Step b2, if the grid point is distributed at the edge position, it is determined that the grid area to which the grid point belongs belongs to the protruding area.
[0083] Specifically, in combination with the principle of coloring the edge light (the specific numerical range of the vector dot product result of the camera view direction and the normal direction of the grid vertex is between 0-1, when the vector dot product result is equal to 0, the camera view direction is perpendicular to the normal direction, at this time it can be determined that the grid region to which the grid vertex belongs is located at the edge of the model; on the contrary, the closer the vector dot product result is to 1, the closer the grid region to which the grid vertex belongs is to the center region of the model), it can be determined that when the vector dot product result between the normal direction of the grid point and the camera view direction is equal to 0 or lower than a preset distance threshold (for example, it can be a value close to 0), it can be determined that the grid point is distributed at the edge position of the target model surface, and the grid region to which the grid point belongs belongs to the protruding region.
[0084] S104, the curved surface subdivision multiplier configured in the protruding region is adjusted to a first curved surface subdivision multiplier, and under the condition that the first curved surface subdivision multiplier is configured in the protruding region, the liquid effect of the target model surface is re-rendered and displayed according to the first liquid mask.
[0085] Here, the curved surface subdivision multiplier is a parameter for controlling the amount of curved surface division along the target model surface, which can add more details where needed; wherein the target model surface is composed of a plurality of grid regions, and the curved surface subdivision multiplier configured in each grid region determines the number of subdivision surfaces of the grid region. The greater the curved surface subdivision multiplier, the more the number of subdivision surfaces of the grid region, and the more the model surface details at the grid region during model rendering (equivalent to the higher attention to the grid region with a large curved surface subdivision multiplier during model rendering, so that the rendered model surface details are more abundant).
[0086] Optionally, before step S104 is performed, the curved surface subdivision multiplier configured in each grid region on the target model surface can be the same or different; when step S104 is performed, only the curved surface subdivision multiplier configured in the protruding region is adjusted, which can effectively improve the attention to the protruding region during model rendering based on the adjusted curved surface subdivision multiplier after the target model is rendered (i.e. under the condition that the curved surface subdivision multiplier configured in the protruding region is adjusted, the target model is rendered according to the first liquid mask), thereby enriching the performance details of the target liquid (static droplets and / or flowing liquid) rendered and displayed in the protruding region, and facilitating to improve the real restoration degree of the liquid effect rendered and displayed on the target model surface (for example, obtaining a more realistic target liquid outline and highlight performance of target liquid reflection).
[0087] It should be noted that the specific value of the first tessellation multiplier only needs to be higher than the tessellation multiplier originally configured for the raised area; wherein when the tessellation multiplier configured for the raised area is increased, a preset tessellation multiplier higher than the tessellation multiplier configured for the raised area can be extracted from a plurality of preset tessellation multipliers as the first tessellation multiplier; or a preset parameter value can be added to or multiplied by the tessellation multiplier configured for the raised area (the preset parameter value used in multiplication operation is greater than 1) to obtain the first tessellation multiplier. The specific value and specific determination method of the first tessellation multiplier are not limited in the embodiments of the present application.
[0088] It should be noted that, in the embodiments of the present application, the tessellation multiplier of the local key area (i.e. the raised area) of the target model surface is selectively increased, rather than the tessellation multiplier of all grid areas of the target model surface being adjusted as a whole. Therefore, it is also beneficial to reduce the model rendering workload increased due to the increase in the number of subdivided faces of the unnecessary area (i.e. the remaining area of the target model surface except the raised area) caused by increasing the tessellation multiplier configured for the unnecessary area, so as to reduce the increase in additional rendering workload on the basis of ensuring the liquid effect of the model surface rendering display, thereby effectively ensuring the work efficiency of the model rendering.
[0089] Optionally, for the remaining area (i.e. the unnecessary area) of the target model surface except the raised area, the tessellation multiplier configured for the remaining area can be lowered to a second tessellation multiplier (similar to the first tessellation multiplier, only the specific value needs to be lower than the tessellation multiplier originally configured for the remaining area); or the tessellation multiplier configured for the remaining area can remain unchanged. The embodiments of the present application do not make any limitation in this regard.
[0090] The steps in the method for controlling the liquid effect of the model surface provided by the embodiments of the present application will be described in detail as follows:
[0091] For the target liquid mask obtained in step S101, it can be divided into a liquid drop mask corresponding to a static liquid drop, a liquid flow mask corresponding to a flowing liquid, and a composite mask obtained by superimposing the liquid drop mask and the liquid flow mask, as described in step S101. The manufacturing method of the target liquid mask will be described in detail as follows:
[0092] Type 1, when only the static liquid drop needs to be rendered and displayed on the target model surface, i.e. when the target liquid mask is the liquid drop mask corresponding to the static liquid drop, in an optional embodiment, Figure 3aA flowchart of a method for generating a droplet mask is shown, and the method comprises steps S101-S103, as shown in the figure. Figure 3a Before step S101, the method comprises steps S301-S303, in particular:
[0093] S301, obtaining a droplet map of the static droplet and a droplet distribution mask associated with the target model.
[0094] Here, the droplet map of the static droplet contains a plurality of droplet images; wherein the method for obtaining the droplet map can refer to the foregoing Figure 2a The related description of the droplet map 201 is not repeated here.
[0095] Here, the droplet distribution mask is used to represent the distribution range of the static droplet on the surface of the target model; wherein, similar to the target liquid mask, the droplet distribution mask also belongs to a black and white image; wherein, the white image area in the droplet distribution mask represents the area on the surface of the target model that displays the static droplet, and the black image area in the droplet distribution mask represents the area on the surface of the target model that does not display the static droplet.
[0096] S302, Gaussian blur processing is performed on the droplet map of the static droplet to obtain a displacement map of the static droplet.
[0097] Here, the method for making the displacement map of the static droplet in step S302 can refer to the foregoing Figure 2a The related description of the displacement map 210 of the static droplet is not repeated here.
[0098] S303, multiplying the displacement map of the static droplet with the droplet distribution mask, and performing an integer operation on the multiplication result to obtain the droplet mask.
[0099] Optionally, as an optional embodiment, the displacement map of the static droplet can be directly multiplied with the droplet distribution mask, that is, the gray value of each point in the displacement map of the static droplet is multiplied with the gray value of each point in the droplet distribution mask, and an integer operation (i.e. rounding) is performed on the multiplication result of each point gray value to obtain a droplet mask with clear boundaries; wherein, in the droplet mask, the white image area is the intersection of the white image area in the displacement map of the static droplet and the white image area in the droplet distribution mask (equivalent to the static droplet that can be displayed in the white image area in the droplet distribution mask), and the black image area is the black image area in the droplet distribution mask (equivalent to the white image area in the displacement map of the static droplet multiplied with the black image area in the droplet distribution mask, still displaying as a black image area).
[0100] Optionally, as another optional embodiment, before multiplying the static droplet replacement map with the droplet distribution mask, the image contrast of the static droplet replacement map can be enhanced according to the image enhancement method described in steps a1-a2, and then the static droplet replacement map with enhanced image contrast is multiplied with the droplet distribution mask to improve the accuracy of the static droplet distribution area (i.e. the white image area) in the droplet mask.
[0101] Optionally, Figure 3b A schematic diagram of a droplet mask production process provided by an embodiment of the present application is shown in FIG. 10, which is described below. Figure 3b As shown in FIG. 10, taking a face model as an example of a target model, a droplet distribution mask 310 associated with the face model (the white image area represents an area capable of displaying static droplets) and a static droplet replacement map 210 can be obtained, wherein, as shown in FIG. 11, the static droplet replacement map 210 can be obtained by adjusting the overall size and distribution density of the static droplets in the droplet map according to actual static droplet rendering display requirements, and performing Gaussian blur processing on the adjusted droplet map. Figure 3b As shown in FIG. 11, the static droplet replacement map 210 obtained by adjusting the overall size and distribution density of the static droplets in the droplet map can be obtained by adjusting the overall size and distribution density of the static droplets in the droplet map before Gaussian blur processing; and as shown in FIG. 12, the static droplet replacement map 210 obtained by adjusting the overall size and distribution density of the static droplets in the droplet map can be obtained by adjusting the overall size and distribution density of the static droplets in the droplet map after Gaussian blur processing. Figure 2a As shown in FIG. 11, the static droplet replacement map 210 obtained by adjusting the overall size and distribution density of the static droplets in the droplet map can be obtained by adjusting the overall size and distribution density of the static droplets in the droplet map before Gaussian blur processing; and as shown in FIG. 12, the static droplet replacement map 210 obtained by adjusting the overall size and distribution density of the static droplets in the droplet map can be obtained by adjusting the overall size and distribution density of the static droplets in the droplet map after Gaussian blur processing. Figure 3b As shown in FIG. 11, the static droplet replacement map 210 obtained by adjusting the overall size and distribution density of the static droplets in the droplet map can be obtained by adjusting the overall size and distribution density of the static droplets in the droplet map before Gaussian blur processing; and as shown in FIG. 12, the static droplet replacement map 210 obtained by adjusting the overall size and distribution density of the static droplets in the droplet map can be obtained by adjusting the overall size and distribution density of the static droplets in the droplet map after Gaussian blur processing.
[0102] Type 2, when only dynamic flowing liquid needs to be rendered and displayed on the surface of the target model, that is, when the target liquid mask is a liquid flow mask corresponding to the flowing liquid, in an optional embodiment, Figure 4a A schematic diagram of a method for generating a liquid flow mask provided by an embodiment of the present application is shown in FIG. 13, which is described below. Figure 4a As shown in FIG. 13, before step S101 is performed, the method includes steps S401-S403, which are described below.
[0103] S401, according to the liquid distribution map associated with the target model, configuring a flow map for the flowing liquid contained in the liquid distribution map to obtain an initial flow mask corresponding to the flowing liquid.
[0104] Here, the liquid distribution map is used to represent the distribution range of the flowing liquid on the surface of the target model; wherein, different from the droplet map of the static droplet, since the flowing liquid is dynamically flowing on the surface of the target model, in the liquid distribution map, the flowing liquid can be distributed in strips, each strip distribution range can correspond to a flow channel of the flowing liquid, and subsequently on the rendered surface of the target model, the flowing liquid can flow in the corresponding flow channel.
[0105] Here, the flow map includes a liquid bead image (i.e. an image of a liquid aggregation part) of the flowing liquid and a liquid tail image (representing liquid tail generated when the liquid bead of the flowing liquid flows); wherein, for the specific size of the flow map, the embodiments of the present application do not make any limitation.
[0106] Optionally, Figure 4b A manufacturing process schematic diagram of a liquid flow mask provided by an embodiment of the present application is shown, as shown in Figure 4b As shown in the figure, the target model is Figure 2b As shown in the figure, the target model is
[0107] S402, configuring a time control function for the flow map in the initial flow mask, to obtain a first liquid flow mask corresponding to the flowing liquid.
[0108] Here, the time control function is used to control the UV coordinates of each point in the flow map to be offset in the vertical direction with time; that is, as shown in the figure, the flow map 410 is taken as an example, through the time control function configured for the flow map 410, the UV coordinates of each point in the liquid bead image and the UV coordinates of each point in the tail image in the flow map 410 can be controlled to be offset downward in the vertical direction with time, so as to realize the dynamic flowing effect of the flowing liquid in the flow map flowing in the vertical direction. Figure 4b
[0109] It should be noted that the time control function only needs to ensure that the UV coordinates of each point can be controlled to be offset in the vertical direction (that is, the UV coordinates of each point are controlled to move in the vertical direction from top to bottom in a cycle) with time, wherein the time control function can be a Time function (returning the time length from 00:00:00 on January 1, 1970, Greenwich time to the current time, and the time length unit is second), or other custom time control functions, and the embodiments of the present application do not make any limitation on this.
[0110] It should be noted that the UV coordinate is a two-dimensional coordinate system used in computer graphics, mainly used to determine a point on a texture image, U represents the position in the horizontal direction, and V represents the position in the vertical direction, and values between 0 and 1 are usually used to represent a pixel position on a texture.
[0111] S403, obtaining the liquid flow mask based on the first liquid flow mask and the liquid distribution map.
[0112] In the embodiments of the present application, the way of making the liquid flow mask based on the first liquid flow mask and the liquid distribution map is not unique. When step S403 is performed, the specific making method of the liquid flow mask can be selected according to the actual liquid effect rendering display requirements, and the embodiments of the present application do not make any limitation on this.
[0113] Specifically, when only the basic liquid flow effect of the target model surface rendering display with flowing liquid over time needs to be ensured (equivalent to not requiring whether the flowing liquid of different flow channels needs to be staggered or not, and not requiring the specific flow rate of the staggered flowing liquid), as an optional embodiment, in the first optional liquid flow mask making method, the first liquid flow mask and the liquid distribution map can be multiplied to obtain the liquid flow mask.
[0114] Here, the specific multiplication method of the first liquid flow mask and the liquid distribution map is similar to the foregoing step S303, and both belong to the multiplication step of the map and the mask. The multiplication method of the replacement map of the static liquid drop and the liquid drop distribution mask in the foregoing step S303 can be referred to, and the repeated parts will not be described here.
[0115] Optionally, as Figure 4bAs shown, configuring each flow liquid in the liquid distribution map 202 with a flow map 410 can obtain an initial flow mask, and configuring each flow map 410 in the initial flow mask with a time control function can obtain a first liquid flow mask 420 capable of controlling the flow liquid in the flow map 410 to flow in the vertical direction through the time control function. Multiplying the first liquid flow mask with the liquid distribution map 202 (not shown in the figure) can obtain a liquid flow mask capable of realizing the basic liquid flow effect (i.e., through the time control function, the flow liquid can be controlled to flow from top to bottom in the flow channel corresponding to itself).
[0116] Here, if the above-mentioned liquid distribution map contains multiple flow liquids (i.e., multiple flow liquids need to be rendered and displayed on the surface of the target model), as an optional embodiment, if it is desired to make different flow liquids flow staggered on the surface of the target model on the basis of realizing the above-mentioned basic liquid flow effect, the above-mentioned step S403 can also be executed according to steps c1-c3 in the second optional liquid flow mask making method, and by making an offset map (used to control the multiple flow liquids in the first liquid flow mask to flow staggered) for the above-mentioned first liquid flow mask, a liquid flow mask capable of not only rendering and displaying flow liquids but also making the multiple flow liquids rendered and displayed flow staggered can be obtained, and specifically:
[0117] Step c1, when the liquid distribution map contains multiple flow liquids, the multiple flow liquids are grouped, and the flow channels corresponding to the flow liquids in the same group are configured with the same gray value to obtain an offset map corresponding to the flow liquids.
[0118] Here, the flow channels corresponding to the flow liquids in different groups are configured with different gray values; that is, since the gray values of different flow liquids in the flow map and the liquid distribution map are the same, the time control function configured in the above-mentioned step S402 is used to control each flow liquid to flow in the flow channel corresponding to itself synchronously (equivalent to the UV coordinates of the points with the same gray value moving the same amount over time), so that by making the above-mentioned offset map, different gray values are used to mark the flow channels of the flow liquids in different groups, so that by superimposing the above-mentioned offset map on the first liquid flow mask, the time control function can control the flow liquids with different gray values to flow staggered.
[0119] It should be noted that when the plurality of flowing liquids included in the liquid distribution map are marked by grouping, the number of groups of the flowing liquids and the number of different gray values of the marks can be selected according to actual liquid effect rendering requirements. The specific number of groups of the flowing liquids and the number of different gray values of the marks are not limited in the embodiments of the present application.
[0120] Optionally, Figure 4c A schematic diagram of an offset map provided by an embodiment of the present application is shown as shown in Figure 4c Figure 4b For example, the liquid distribution map 202 shown in the figure can be marked by 8 levels of gray (i.e. 8 different gray values) for the flow channels corresponding to each flowing liquid, that is, the plurality of flowing liquids included in the liquid distribution map 202 are divided into 8 groups, and the flow channels of the plurality of flowing liquids in each group correspond to the same gray value.
[0121] Step c2, superimposing the offset map on the UV coordinates of each point in the first liquid flow mask to obtain a second liquid flow mask corresponding to the flowing liquid.
[0122] Here, superimposing the above offset map on the UV coordinates of each point in the first liquid flow mask to obtain the second liquid flow mask can make the time control function control the flowing liquids in the flow channels marked by different gray values to realize the liquid flow effect of staggered flow in the second liquid flow mask.
[0123] Step c3, multiplying the second liquid flow mask and the liquid distribution map to obtain the liquid flow mask.
[0124] Here, step c3 is similar to the aforementioned step S303, both of which belong to the multiplication step of the map and the mask. The specific implementation of step c3 can refer to the way of multiplying the replacement map of the static liquid droplet and the droplet distribution mask in the aforementioned step S303, and the repeated parts will not be described here.
[0125] It should be noted that before superimposing the offset map in step c2, the offset map can also be processed by the following formula to avoid noise points (i.e. to cause image precision to decrease) that may occur in the use process of the offset map. Specifically:
[0126] offset 输出 = Round(offset 输入 ×n) / n;
[0127] Wherein, offset 2 represents the processed offset map;
[0128] offset 2 an offset map before processing;
[0129] n is the total number of different gray values contained in the offset map;
[0130] Round(x) represents rounding off the variable x in the parentheses.
[0131] Here, if the above liquid distribution map contains multiple flowing liquids (i.e. multiple flowing liquids need to be rendered and displayed on the surface of the target model), as an optional embodiment, if it is desired to enrich the flow details of each flowing liquid on the basis of realizing that the multiple different flowing liquids can flow staggered, so that the multiple flowing liquids can flow staggered according to different flow speeds, then in the third optional liquid flow mask making method, the above step S403 can also be performed by the following steps d1-d4. By configuring a flow speed multiplier for the offset map, the flow speeds of different groups of flowing liquids are different, and a liquid flow mask is obtained, in which the multiple flowing liquids rendered and displayed can flow staggered according to different flow speeds, thereby effectively improving the real restoration degree of the liquid effect rendered on the surface of the target model.
[0132] Step d1, when the liquid distribution map contains multiple flowing liquids, the multiple flowing liquids are grouped, and the flow channels corresponding to the flowing liquids in the same group are configured with the same gray value, and the offset map corresponding to the flowing liquids is obtained.
[0133] Here, the gray values configured for the flow channels corresponding to the flowing liquids in different groups in step d1 are different, wherein the making method of the offset map in step d1 is the same as the above step c1, and the repeated parts will not be described here.
[0134] Step d2, multiplying the offset map by a flow speed parameter to obtain a target offset map.
[0135] Here, the flow speed parameter is used to represent the flow speed of the flowing liquid in the flow channel; wherein, since different gray values in the offset map mark the flow channels of different groups of flowing liquids, after multiplying the offset map by the flow speed parameter, the flow speeds of the flowing liquids in the flow channels marked by different gray values in the target offset map are also different.
[0136] Specifically, since the lighter the color of the flow channel in the offset map (i.e. the closer to white), the larger the corresponding gray value (for example, the gray value of white is 1 or 255), therefore, after multiplying by the same flow speed parameter, in the target offset map, the flow speed of the subsequent corresponding flowing liquid of the flow channel with lighter color is faster.
[0137] Step d3, superimpose the target offset map on the UV coordinates of each point in the first liquid flow mask to obtain a third liquid flow mask corresponding to the flowing liquid.
[0138] Here, the specific implementation of step d3 is the same as the aforementioned step c2, and the repeated parts will not be repeated here.
[0139] Step d4, multiply the third liquid flow mask and the liquid distribution map to obtain the liquid flow mask.
[0140] Here, the specific implementation of step d4 is the same as the aforementioned step c3, and the repeated parts will not be repeated here.
[0141] In another optional embodiment, Figure 5 Another method for generating a liquid flow mask is shown in the flowchart of the embodiment of the present application, as shown in Figure 5 Before performing the above step S101, the method includes steps S501-S502, specifically:
[0142] S501, according to the liquid distribution map associated with the target model, control the flowing liquid in the liquid distribution map to flow in the vertical direction with time change to obtain a plurality of liquid flow image frames corresponding to different time control nodes.
[0143] Optionally, for each flowing liquid included in the liquid distribution map, when controlling the flowing liquid in the liquid distribution map to flow in the vertical direction with time change, at different time control nodes, according to the actual liquid effect rendering requirement, the image size of the liquid bead image in the flowing liquid can be controlled to increase with time, or the liquid image in the flowing liquid can be controlled to move downward in the flow channel with time.
[0144] It should be noted that in different liquid flow image frames corresponding to different time control nodes, the liquid bead image in the same flowing liquid can change in image size, or change in image position, or change in both image size and image position. The specific image content of each liquid flow image frame is not limited by the embodiments of the present application.
[0145] S502, according to the node time sequence of the time control nodes, sort the plurality of liquid flow image frames to obtain a sorted liquid flow image sequence as the liquid flow mask.
[0146] Optionally, according to the node time sequence of the time control node, the liquid flow image frame with earlier node time can be placed before the liquid flow image frame with later node time, and a liquid flow image sequence composed of the sorted liquid flow image frames is obtained as the liquid flow mask. At this time, each liquid flow image frame contained in the liquid flow mask is played in sequence on the target model surface according to the above node time sequence, and the flow effect of the liquid can be displayed on the target model surface.
[0147] It should be noted that, compared with the method of manufacturing the liquid flow mask by multiple liquid flow image frames in steps S501-S502, when the liquid flow mask is manufactured according to the method described in the foregoing steps S401-S403, since the liquid flow effect is realized by shifting the UV coordinates of each point based on the time control function, at least one map (combining the normal map, the displacement map and the offset map of the flowing liquid into one map, wherein the RG channel is the RG channel of the normal map, the B channel is the displacement map, and the A channel is the offset map) can realize the infinitely circulating liquid flow effect in time, thereby effectively reducing the storage and manufacturing cost of the map.
[0148] Type 3, when it is required to simultaneously render and display the above static liquid droplet and the above dynamic flowing liquid on the target model surface, that is, when the target liquid mask is the above composite mask, the above droplet mask (the generation method is referred to the foregoing steps S301-S303) and the above liquid flow mask (the generation method is referred to the foregoing steps S401-S403 or steps S501-S502) are superimposed using the addition function, and the above composite mask is obtained.
[0149] Here, when the target liquid mask is the above composite mask, in an optional embodiment, Figure 6 A flowchart of a method for generating a first liquid mask is shown, as shown in Figure 6 When the above step S102 is executed, the method includes steps S601-S603, specifically:
[0150] S601, multiplying the target liquid mask and the displacement map of the static liquid droplet to obtain a first to-be-processed mask.
[0151] Here, step S601 is similar to the foregoing step S303, both belong to the multiplication step of the map and the mask, and the specific implementation of step S601 can refer to the way of multiplying the displacement map of the static liquid droplet and the droplet distribution mask in the foregoing step S303, and the repeated parts will not be described here.
[0152] S602, multiplying the target liquid mask and the displacement map of the flowing liquid to obtain a second to-be-processed mask.
[0153] Here, step S602 is similar to the aforementioned step S303, both of which belong to the multiplication step of the map and the mask, and the specific implementation of step S602 can refer to the way of multiplying the displacement map of the static droplet and the droplet distribution mask in the aforementioned step S303. The repeated parts will not be described here.
[0154] S603, by mixing the lightening function, mixing the first to-be-processed mask and the second to-be-processed mask to obtain the first liquid mask.
[0155] Specifically, the input of the Blend_Lighten function (mixing lightening function) is the first gray value corresponding to the same position point in the target liquid mask in the first to-be-processed mask and the second gray value corresponding to the same position point in the second to-be-processed mask. The mixing lightening function will automatically return the target gray value with the maximum value of the input two gray values (i.e. the first gray value and the second gray value) as the gray value corresponding to the position point in the first liquid mask (i.e. the larger the number of the gray value, the lighter the color corresponding to the position point, and the brighter the brightness).
[0156] Here, when the target liquid mask is the composite mask, as an optional embodiment, when making the first liquid mask, the normal information of the static droplet and the normal information of the flowing liquid can also be mixed according to the method described in the following steps e1-e4 to obtain the normal information of the mixed first liquid mask. Specifically:
[0157] Step e1, multiplying the normal map of the static droplet and the first liquid mask to obtain a third to-be-processed mask.
[0158] Here, step e1 is similar to the aforementioned step S303, both of which belong to the multiplication step of the map and the mask, and the specific implementation of step e1 can refer to the way of multiplying the displacement map of the static droplet and the droplet distribution mask in the aforementioned step S303. The repeated parts will not be described here.
[0159] Step e2, multiplying the normal map of the flowing liquid and the first liquid mask to obtain a fourth to-be-processed mask.
[0160] Here, step e2 is similar to the aforementioned step S303, both of which belong to the multiplication step of the map and the mask, and the specific implementation of step e2 can refer to the way of multiplying the displacement map of the static droplet and the droplet distribution mask in the aforementioned step S303. The repeated parts will not be described here.
[0161] Step e3, by mixing the lightening function, mixing the R value and the G value in the third to-be-processed mask and the fourth to-be-processed mask respectively to obtain the mixed normal R value and the mixed normal G value in the normal information of the mixed first liquid mask.
[0162] Specifically, the input of the mixed brightening function is the first normal R value of the same position point in the first liquid mask corresponding to the third to-be-processed mask and the second normal R value corresponding to the fourth to-be-processed mask, and the mixed brightening function automatically returns the target normal R value with the maximum value in the input two normal R values (i.e., the first normal R value and the second normal R value) as the mixed normal R value in the normal information of the first liquid mask after mixing.
[0163] Specifically, the input of the mixed brightening function is the first normal G value of the same position point in the first liquid mask corresponding to the third to-be-processed mask and the second normal G value corresponding to the fourth to-be-processed mask, and the mixed brightening function automatically returns the target normal G value with the maximum value in the input two normal G values (i.e., the first normal G value and the second normal G value) as the mixed normal G value in the normal information of the first liquid mask after mixing.
[0164] Step e3, according to the mixed normal R value and the mixed normal G value, the mixed normal B value in the normal information of the first liquid mask after mixing is calculated.
[0165] Specifically, the mixed normal B value can be calculated according to the following formula:
[0166] Z=sqrt[1-(x 2 +y 2 )];
[0167] Wherein, Z represents the mixed normal B value;
[0168] x represents the mixed normal R value;
[0169] y represents the mixed normal G value;
[0170] Sqrt represents the square root function.
[0171] On the basis of the above steps S101-S104, in addition to the surface subdivision multiplier, the replacement map of the target liquid is also used in the process of making the first liquid mask (i.e., the replacement map of the target liquid is superimposed on the target liquid mask to obtain the first liquid mask), and adjusting the replacement intensity parameter corresponding to the replacement map can change the vertex offset degree of the model surface grid point displayed based on the adjusted first liquid mask, thereby realizing the change of the shape of the liquid gathering part (i.e., the static liquid drop and / or the liquid gathering part in the flowing liquid) in the liquid effect (such as whether the bottom of the water drop / sweat drop presents a circular shape or a sharp cone shape), therefore, as an optional embodiment,Figure 7a A flowchart of a method for adjusting the bottom shape of a liquid aggregation part rendered and displayed is shown, as shown in Figure 7a As shown in the above step S104, the method comprises steps S701-S703, specifically:
[0172] S701, under the condition of replacing the target liquid mask with the first liquid mask, determining the edge protrusion degree of the target liquid on the surface of the target model from the target model rendered based on the first liquid mask.
[0173] Here, after rendering the target model using the first liquid mask, the user can choose to view the rendered target model in the normal lighting mode in the virtual engine, or choose to view the rendered target model in the wireframe mode; wherein, unlike the normal lighting mode, in the wireframe mode, the grid composition structure of the rendered target model is displayed in the virtual engine.
[0174] Specifically, compared with the normal lighting mode, in the wireframe mode, the edge protrusion degree of the target liquid on the surface of the target model can be more accurately determined from the rendered target model; wherein, the edge protrusion degree can be concretely represented as the height difference between the liquid at the bottom of the target liquid and the surface of the target model (which is equivalent to the protrusion height of the target liquid on the surface of the target model).
[0175] Optionally, Figure 7b A schematic diagram of a rendered target model displayed in the wireframe mode is shown, as shown in Figure 7b As shown in the wireframe mode, the liquid aggregation shape of the target liquid at the bottom indicated by the white arrow in the rendered target model 700 can be obtained as the specific representation data of the edge protrusion degree of the target liquid on the surface of the target model.
[0176] S702, according to the edge protrusion degree, adjusting the displacement strength parameter corresponding to the displacement map of the target liquid, and performing parameter update on the first liquid mask based on the adjusted displacement map of the target liquid, to obtain a second liquid mask.
[0177] Specifically, when using the protrusion height of the target liquid on the surface of the target model to represent the edge protrusion degree of the target liquid on the surface of the target model, at least the following three types can be divided:
[0178] Type 1, when the protruding height of the target liquid on the target model surface is lower than the first preset protruding height threshold, it can be determined that the edge protruding degree of the target liquid on the target model surface is not obvious, at this time, the replacement intensity parameter corresponding to the replacement map of the target liquid can be adjusted, and the adjusted replacement intensity parameter is multiplied by the vertex normal of each point of the first liquid mask, wherein the greater the value of the replacement intensity parameter, the greater the degree of offset of the vertex normal, and the more obvious the edge protruding degree of the target liquid rendered and displayed on the target model surface based on the second liquid mask subsequently.
[0179] Type 2, when the protruding height of the target liquid on the target model surface is greater than or equal to the first preset protruding height threshold and less than the second preset protruding height threshold, it can be determined that the edge protruding degree of the target liquid on the target model surface is moderate, at this time, the replacement intensity parameter corresponding to the replacement map of the target liquid can be maintained unchanged.
[0180] Type 3, when the protruding height of the target liquid on the target model surface is greater than the second preset protruding height threshold, it can be determined that the edge protruding degree of the target liquid on the target model surface is too obvious (for example, the liquid gathering part at the bottom of the target liquid presents a sharp cone shape, and the height difference between the vertex of the sharp cone area and the target model surface is too large), at this time, the replacement intensity parameter corresponding to the replacement map of the target liquid can be adjusted, and the adjusted replacement intensity parameter is multiplied by the vertex normal of each point of the first liquid mask, wherein the value of the replacement intensity parameter is reduced, and the degree of offset of the vertex normal is also reduced, and the edge protruding degree of the target liquid rendered and displayed on the target model surface based on the second liquid mask subsequently will recover from the previous too protruding state to a more moderate normal state.
[0181] S703, according to the second liquid mask, re-render the liquid effect of the target model surface.
[0182] Here, the implementation of step S703 is the same as the way of rendering the target model using the first liquid mask in step S104, and the repeated parts will not be described here.
[0183] Here, when adjusting the bottom shape of the liquid gathering part rendered and displayed according to the method described in steps S701-S703, if the gravity effect of the liquid gathering part rendered and displayed is not obvious (for example, the droplets on the target model surface present a state of not obvious particles, the liquid gathering part of the flowing liquid has no obvious dripping effect, etc.), as an optional embodiment, after executing the above step S702 (that is, after obtaining the above second liquid mask), the following steps f1-f2 can be continued to add gravity effect to the above liquid gathering part rendered and displayed subsequently, in particular:
[0184] Step f1, determining a target local area from the second liquid mask, and configuring a target vector for representing gravity effect for the target local area, to obtain a third liquid mask.
[0185] Here, the target local area includes a first distribution area corresponding to a static liquid drop and / or a liquid gathering area in flowing liquid (e.g., a gathering area of water droplets in water flow, a gathering area of sweat droplets in sweat flow, etc.).
[0186] Here, the target vector is a vertical vector pointing from the target model surface to the virtual ground direction, and the specific vector value of the target vector is not limited by the embodiments of the present application.
[0187] Step f2, re-rendering the liquid effect of the target model surface according to the third liquid mask.
[0188] Optionally, Figure 7c A comparison diagram of the target model surface before and after adding gravity effect is shown, as shown in Figure 7c As the target local area is not added with the target vector for representing gravity effect, in the target model 710 rendered using the second liquid mask, the bottom gathering area of the target liquid does not show the liquid droplet effect consistent with gravity; and after the target local area is added with the target vector for representing gravity effect, in the target model 720 rendered using the third liquid mask, the bottom gathering area of the target liquid shows a more obvious liquid droplet effect.
[0189] For the specific implementation of the above step S104, when re-rendering the target model according to the first liquid mask, if the target model itself is not associated with a base material (e.g., the target model is an original model whose surface is not wrapped with any material), the first liquid mask can be directly used to re-render the target model.
[0190] If the target model itself is associated with a base material (e.g., a virtual human model surface is wrapped with a skin material, an object surface is wrapped with a plastic material, a metal material, etc.), as an optional embodiment, the first liquid mask and the base material associated with the target model itself can still be directly used to render the target model.
[0191] Optionally, as another optional embodiment, the first liquid mask and the base material associated with the target model itself can be mixed to obtain a new composite material with liquid effect, and then the composite material can be used to render the target model, according to the method described in steps g1-g2, specifically:
[0192] Step g1, superimpose the first liquid mask on the base material associated with the target model by linear interpolation to obtain a composite material.
[0193] Here, when linearly interpolating the base material and the first liquid mask, the Specular, Roughness, Normal, and Opacity information of the base material and the first liquid mask can be linearly interpolated.
[0194] Specifically, for each material attribute parameter, the first parameter value corresponding to the material attribute parameter in the first liquid mask is taken as the target value, and the second parameter value corresponding to the material attribute parameter in the base material is taken as the initial value. A plurality of transition parameter values are sequentially inserted between the initial value and the target value by linear interpolation to obtain the parameter value distribution range of each material attribute parameter in the composite material.
[0195] Step g2, render the target model according to the composite material to obtain a target model with the liquid effect displayed on the model surface.
[0196] Here, the implementation of step g2 is the same as the way of rendering the target model using the first liquid mask in step S104, and the repeated parts will not be described here.
[0197] Based on the above-mentioned model surface liquid effect control method provided by the embodiments of the present application, the target liquid mask for rendering and displaying the liquid effect on the target model surface is obtained; the replacement map of the target liquid is superimposed on the target liquid mask according to the target liquid corresponding to the target liquid mask to obtain the first liquid mask; under the condition that the target liquid mask is replaced by the first liquid mask, the convex region distributed on the target model surface is determined from the target model rendered based on the first liquid mask; the surface subdivision multiplier configured in the convex region is increased to the first surface subdivision multiplier, and under the condition that the first surface subdivision multiplier is configured in the convex region, the liquid effect on the target model surface is re-rendered according to the first liquid mask. In this way, the present application supports the presentation of liquid effect on various shading models such as the sub-surface scattering shading model, so that the presentation of liquid effect is not limited by the type of shading model, and at the same time, the liquid effect rendered and displayed on the model surface can be quickly and conveniently adjusted by modifying the material attribute parameters such as the surface subdivision multiplier, effectively improving the control efficiency of the liquid effect and the degree of true restoration of the liquid effect.
[0198] Based on the same inventive concept, the application also provides a control device corresponding to the control method of the liquid effect of the model surface, since the control device in the embodiments of the application solves the problem in the same way as the control method of the liquid effect of the model surface in the embodiments of the application, and therefore the implementation of the control device can be referred to the implementation of the control method, and the repeated parts will not be described here.
[0199] With reference to Figure 8 , as shown in the figure, Figure 8 The structure of a control device for the liquid effect of a model surface is shown, wherein the control device comprises:
[0200] The acquisition module 801 is configured to acquire a target liquid mask for rendering and displaying a liquid effect on a target model surface.
[0201] The mask making module 802 is configured to superimpose a displacement map of a target liquid on the target liquid mask according to a target liquid corresponding to the target liquid mask, to obtain a first liquid mask; wherein the target liquid comprises static droplets and / or flowing liquid.
[0202] The adjustment module 803 is configured to, under the condition that the target liquid mask is replaced by the first liquid mask, determine a raised area distributed on the target model surface from the target model rendered based on the first liquid mask.
[0203] The rendering module 804 is configured to increase the surface subdivision multiplier configured for the raised area to a first surface subdivision multiplier, and under the condition that the first surface subdivision multiplier is configured for the raised area, re-render the liquid effect of the target model surface according to the first liquid mask.
[0204] In an optional implementation, the target liquid mask comprises a droplet mask corresponding to the static droplets, and the acquisition module 801 is configured to generate the droplet mask by the following method:
[0205] Acquire a droplet map of the static droplets and a droplet distribution mask associated with the target model; wherein the droplet distribution mask is used to represent the distribution range of the static droplets on the target model surface.
[0206] Perform Gaussian blur processing on the droplet map of the static droplets to obtain a displacement map of the static droplets.
[0207] Multiply the displacement map of the static droplets with the droplet distribution mask, and perform an integer operation on the multiplication result to obtain the droplet mask.
[0208] In an optional implementation, the target liquid mask comprises a liquid flow mask corresponding to the flowing liquid, the obtaining module 801 is configured to generate the liquid flow mask by the following method:
[0209] According to the liquid distribution map associated with the target model, a flow map is configured for the flowing liquid in the liquid distribution map, to obtain an initial flow mask corresponding to the flowing liquid; wherein the liquid distribution map is used to represent the distribution range of the flowing liquid on the surface of the target model; the flow map comprises a liquid bead image and a liquid tail image of the flowing liquid.
[0210] A time control function is configured for the flow map in the initial flow mask, to obtain a first liquid flow mask corresponding to the flowing liquid; wherein the time control function is used to control the UV coordinates of each point in the flow map to be offset in the vertical direction over time.
[0211] The liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map.
[0212] In an optional implementation, when the liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, the obtaining module 801 is configured to:
[0213] The first liquid flow mask is multiplied by the liquid distribution map to obtain the liquid flow mask.
[0214] In an optional implementation, when the liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, the obtaining module 801 is configured to:
[0215] When the liquid distribution map comprises a plurality of flowing liquids, the plurality of flowing liquids are grouped, and the flow channels corresponding to the flowing liquids in the same group are configured with the same gray value to obtain an offset map corresponding to the flowing liquids; wherein the gray values configured for the flow channels corresponding to the flowing liquids in different groups are different.
[0216] The offset map is superimposed on the UV coordinates of each point in the first liquid flow mask to obtain a second liquid flow mask corresponding to the flowing liquid.
[0217] The second liquid flow mask is multiplied by the liquid distribution map to obtain the liquid flow mask.
[0218] In an optional implementation, when the liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, the obtaining module 801 is configured to:
[0219] When the liquid distribution map contains multiple flowing liquids, the multiple flowing liquids are grouped, and the flowing channels corresponding to the flowing liquids in the same group are configured with the same gray value to obtain an offset map corresponding to the flowing liquids; wherein the flowing channels corresponding to the flowing liquids in different groups are configured with different gray values.
[0220] The offset map is multiplied by a flow speed parameter to obtain a target offset map; wherein the flow speed parameter is used to represent the corresponding flow speed of the flowing liquid in the flowing channel;
[0221] The target offset map is superimposed on the UV coordinates of each point in the first liquid flow mask to obtain a third liquid flow mask corresponding to the flowing liquid;
[0222] The third liquid flow mask is multiplied by the liquid distribution map to obtain the liquid flow mask.
[0223] In an optional implementation, the target liquid mask contains a liquid flow mask corresponding to the flowing liquid, and the obtaining module 801 is configured to generate the liquid flow mask by the following method:
[0224] According to the liquid distribution map associated with the target model, the flowing liquid in the liquid distribution map is controlled to flow in the vertical direction over time to obtain a plurality of liquid flow image frames corresponding to different time control nodes;
[0225] The plurality of liquid flow image frames are sorted in the node time order of the time control nodes to obtain a sorted liquid flow image sequence as the liquid flow mask.
[0226] In an optional implementation, the target liquid mask contains a liquid droplet mask corresponding to the static liquid droplet and a liquid flow mask corresponding to the flowing liquid, and when the target liquid corresponding to the target liquid mask is superimposed on the replacement map of the target liquid on the target liquid mask, the mask making module 802 is configured to:
[0227] The target liquid mask is multiplied by the replacement map of the static liquid droplet to obtain a first to-be-processed mask;
[0228] The target liquid mask is multiplied by the replacement map of the flowing liquid to obtain a second to-be-processed mask;
[0229] The first to-be-processed mask and the second to-be-processed mask are mixed by a mixed lightening function to obtain the first liquid mask.
[0230] In an optional implementation, when determining the convex region distributed on the surface of the target model from the target model rendered based on the first liquid mask, the adjusting module 803 is configured to:
[0231] After rendering the target model based on the first liquid mask, for a grid point on the surface of the rendered target model, it is determined whether the grid point is distributed at an edge position of the surface of the target model according to a dot product result between a normal direction of the grid point and a camera view direction.
[0232] If the grid point is distributed at the edge position, it is determined that a grid region to which the grid point belongs belongs to the convex region.
[0233] In an optional implementation, the control device further includes a replacement intensity adjusting module, which is configured to:
[0234] Under the condition that the target liquid mask is replaced by the first liquid mask, the edge convexity degree of the target liquid on the surface of the target model is determined from the target model rendered based on the first liquid mask.
[0235] According to the edge convexity degree, the replacement intensity parameter corresponding to the replacement map of the target liquid is adjusted, and the first liquid mask is parameter updated based on the replacement map of the target liquid after adjustment to obtain a second liquid mask.
[0236] According to the second liquid mask, the liquid effect of the surface of the target model is re-rendered and displayed.
[0237] In an optional implementation, after the second liquid mask is obtained, the replacement intensity adjusting module is further configured to:
[0238] A target local region is determined from the second liquid mask, and a target vector used to represent a gravity effect is configured for the target local region to obtain a third liquid mask; wherein the target local region includes a first distribution region corresponding to the static droplet and / or a liquid aggregation region in the flowing liquid.
[0239] According to the third liquid mask, the liquid effect of the surface of the target model is re-rendered and displayed.
[0240] In an optional implementation, when the liquid effect of the surface of the target model is re-rendered and displayed according to the first liquid mask, the rendering module 804 is configured to:
[0241] The first liquid mask is superimposed on the base material associated with the target model by linear interpolation to obtain a composite material.
[0242] According to the composite material, the target model is rendered to obtain a target model in which the liquid effect is displayed on the model surface.
[0243] Based on the above-mentioned model surface liquid effect control device provided by the embodiment of the application, the target liquid mask for rendering and displaying the liquid effect on the target model surface is obtained; the displacement map of the target liquid corresponding to the target liquid mask is superimposed on the target liquid mask to obtain a first liquid mask; under the condition that the target liquid mask is replaced by the first liquid mask, the protruding area distributed on the target model surface is determined from the target model rendered based on the first liquid mask; the surface subdivision multiplier configured in the protruding area is increased to a first surface subdivision multiplier, and under the condition that the first surface subdivision multiplier is configured in the protruding area, the liquid effect displayed on the target model surface is re-rendered according to the first liquid mask. In this way, the application supports presenting the liquid effect on various coloring models such as the subsurface scattering coloring model, so that the presentation of the liquid effect is not limited by the type of coloring model, and at the same time, the liquid effect rendered and displayed on the model surface can be quickly and conveniently adjusted by modifying the material attribute parameters such as the surface subdivision multiplier, thereby effectively improving the control efficiency of the liquid effect and the degree of true restoration of the liquid effect.
[0244] Based on the same inventive concept, the application also provides an electronic device corresponding to the above-mentioned model surface liquid effect control method. Since the principle of solving the problem in the electronic device in the embodiment of the application is similar to the above-mentioned model surface liquid effect control method in the embodiment of the application, the implementation of the electronic device can be referred to the implementation of the above-mentioned control method, and the repeated parts will not be described again.
[0245] Figure 9 A structural schematic diagram of an electronic device 900 provided by the embodiment of the application, comprising: a processor 901, a memory 902 and a bus 903, the memory 902 stores machine readable instructions executable by the processor 901, when the electronic device runs a model surface liquid effect control method as in the embodiment, the processor 901 and the memory 902 communicate through the bus 903, the processor 901 executes the machine readable instructions, and the processor 901 executes the machine readable instructions to realize the following steps, specifically:
[0246] obtaining a target liquid mask for rendering and displaying a liquid effect on a target model surface;
[0247] superimposing a displacement map of a target liquid corresponding to the target liquid mask on the target liquid mask to obtain a first liquid mask; wherein the target liquid comprises:
[0248] static droplets and / or flowing liquid;
[0249] determine, from the target model rendered based on the first liquid mask, a protruding region distributed on a surface of the target model under a condition that the target liquid mask is replaced by the first liquid mask;
[0250] increase a tessellation multiplier of the protruding region to a first tessellation multiplier, and re-render a liquid effect of the surface of the target model according to the first liquid mask under a condition that the first tessellation multiplier is configured in the protruding region.
[0251] In an optional implementation, the target liquid mask includes a liquid drop mask corresponding to the static liquid drop, and the processor 901 is configured to generate the liquid drop mask by the following method:
[0252] obtain a liquid drop map of the static liquid drop and a liquid drop distribution mask associated with the target model, wherein the liquid drop distribution mask is used to represent a distribution range of the static liquid drop on the surface of the target model;
[0253] perform Gaussian blur processing on the liquid drop map of the static liquid drop to obtain a replacement map of the static liquid drop;
[0254] multiply the replacement map of the static liquid drop by the liquid drop distribution mask, and perform an integer operation on a multiplication result to obtain the liquid drop mask.
[0255] In an optional implementation, the target liquid mask includes a liquid flow mask corresponding to the flowing liquid, and the processor 901 is configured to generate the liquid flow mask by the following method:
[0256] configure a flow map in a liquid distribution map associated with the target model to obtain an initial flow mask corresponding to the flowing liquid, wherein the liquid distribution map is used to represent a distribution range of the flowing liquid on the surface of the target model, and the flow map includes a liquid bead image and a liquid tail image of the flowing liquid;
[0257] configure a time control function in the flow map in the initial flow mask to obtain a first liquid flow mask corresponding to the flowing liquid, wherein the time control function is used to control UV coordinates of each point in the flow map to be offset in a vertical direction with time;
[0258] obtain the liquid flow mask based on the first liquid flow mask and the liquid distribution map.
[0259] In an optional implementation, when the liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, the processor 901 is configured to:
[0260] multiply the first liquid flow mask and the liquid distribution map to obtain the liquid flow mask.
[0261] In an optional implementation, when the liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, the processor 901 is configured to:
[0262] when the liquid distribution map contains multiple flowing liquids, the multiple flowing liquids are grouped, and the flowing channels corresponding to the flowing liquids in the same group are configured with the same gray value to obtain an offset map corresponding to the flowing liquids; and the flowing channels corresponding to the flowing liquids in different groups are configured with different gray values.
[0263] superimpose the offset map on the UV coordinates of each point in the first liquid flow mask to obtain a second liquid flow mask corresponding to the flowing liquids.
[0264] multiply the second liquid flow mask and the liquid distribution map to obtain the liquid flow mask.
[0265] In an optional implementation, when the liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, the processor 901 is configured to:
[0266] when the liquid distribution map contains multiple flowing liquids, the multiple flowing liquids are grouped, and the flowing channels corresponding to the flowing liquids in the same group are configured with the same gray value to obtain an offset map corresponding to the flowing liquids; and the flowing channels corresponding to the flowing liquids in different groups are configured with different gray values.
[0267] multiply the offset map and a flow velocity parameter to obtain a target offset map; wherein the flow velocity parameter is used to represent the corresponding flow velocity of the flowing liquid in the flowing channel.
[0268] superimpose the target offset map on the UV coordinates of each point in the first liquid flow mask to obtain a third liquid flow mask corresponding to the flowing liquids.
[0269] multiply the third liquid flow mask and the liquid distribution map to obtain the liquid flow mask.
[0270] In an optional implementation, the target liquid mask contains a liquid flow mask corresponding to the flowing liquid, and the processor 901 is configured to generate the liquid flow mask by the following method:
[0271] controlling the flowing liquid in the liquid distribution map to flow in a vertical direction over time according to the liquid distribution map associated with the target model, to obtain a plurality of liquid flow image frames corresponding to different time control nodes;
[0272] sequencing the plurality of liquid flow image frames in a node time sequence of the time control nodes to obtain a sequenced liquid flow image sequence as the liquid flow mask.
[0273] In an optional implementation, the target liquid mask includes a liquid drop mask corresponding to the static liquid drop and a liquid flow mask corresponding to the flowing liquid. When the target liquid is overlaid with the displacement map of the target liquid on the target liquid mask according to the target liquid corresponding to the target liquid mask, the processor 901 is configured to:
[0274] multiply the target liquid mask and the displacement map of the static liquid drop to obtain a first to-be-processed mask;
[0275] multiply the target liquid mask and the displacement map of the flowing liquid to obtain a second to-be-processed mask;
[0276] mix the first to-be-processed mask and the second to-be-processed mask by a mixing brightening function to obtain the first liquid mask.
[0277] In an optional implementation, when the raised area distributed on the surface of the target model is determined from the target model rendered based on the first liquid mask, the processor 901 is configured to:
[0278] after the target model is rendered based on the first liquid mask, for a grid point on the surface of the rendered target model, determining whether the grid point is distributed at an edge position of the surface of the target model according to a dot product result of a vector between a normal direction of the grid point and a camera view direction;
[0279] if the grid point is distributed at the edge position, determining that a grid area to which the grid point belongs belongs to the raised area.
[0280] In an optional implementation, the processor 901 is further configured to:
[0281] determine an edge raised degree of the target liquid on the surface of the target model from the target model rendered based on the first liquid mask, under the condition that the target liquid mask is replaced by the first liquid mask.
[0282] According to the edge protrusion degree, adjust a displacement strength parameter corresponding to the target liquid displacement map, and perform parameter updating on the first liquid mask based on the adjusted target liquid displacement map, to obtain a second liquid mask;
[0283] According to the second liquid mask, re-render a liquid effect displayed on the target model surface.
[0284] In an optional implementation, after the second liquid mask is obtained, the processor 901 is further configured to:
[0285] According to the second liquid mask, re-render a liquid effect displayed on the target model surface.
[0286] According to the second liquid mask, re-render a liquid effect displayed on the target model surface.
[0287] In an optional implementation, when the liquid effect displayed on the target model surface is re-rendered according to the first liquid mask, the processor 901 is configured to:
[0288] Superimpose the first liquid mask on the base material of the target model by linear interpolation, to obtain a composite material;
[0289] According to the composite material, render the target model, to obtain a target model with the liquid effect displayed on the model surface.
[0290] By means of the electronic device provided in the embodiments of the present application, a target liquid mask for rendering and displaying a liquid effect on a target model surface is obtained; a displacement map of a target liquid is superimposed on the target liquid mask according to the target liquid corresponding to the target liquid mask, to obtain a first liquid mask; under the condition that the target liquid mask is replaced by the first liquid mask, a protruding area distributed on the target model surface is determined from the target model rendered based on the first liquid mask; a surface subdivision multiplier configured for the protruding area is increased to a first surface subdivision multiplier, and the liquid effect displayed on the target model surface is re-rendered according to the first liquid mask under the condition that the first surface subdivision multiplier is configured for the protruding area. In this way, the present application supports presenting a liquid effect on a plurality of shading models such as a subsurface scattering shading model, so that the presentation of the liquid effect is not limited by the type of the shading model, and the liquid effect rendered and displayed on the model surface can be quickly and conveniently adjusted by modifying material attribute parameters such as the surface subdivision multiplier, thereby effectively improving the control efficiency of the liquid effect and the degree of real restoration of the liquid effect.
[0291] Based on the same inventive concept, the application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to perform the following steps:
[0292] obtaining a target liquid mask for rendering and displaying a liquid effect on a surface of a target model;
[0293] superimposing a displacement map of a target liquid on the target liquid mask according to the target liquid corresponding to the target liquid mask to obtain a first liquid mask; wherein the target liquid includes static droplets and / or flowing liquid;
[0294] determining a raised area distributed on the surface of the target model from the target model rendered based on the first liquid mask under the condition that the target liquid mask is replaced by the first liquid mask;
[0295] increasing a tessellation multiplier configured for the raised area to a first tessellation multiplier, and re-rendering the liquid effect of the surface of the target model according to the first liquid mask under the condition that the first tessellation multiplier is configured for the raised area.
[0296] In an optional implementation, the target liquid mask includes a droplet mask corresponding to the static droplets, and the processor is configured to generate the droplet mask by the following method:
[0297] obtaining a droplet map of the static droplets and a droplet distribution mask associated with the target model; wherein the droplet distribution mask is used to represent a distribution range of the static droplets on the surface of the target model;
[0298] performing Gaussian blur processing on the droplet map of the static droplets to obtain a displacement map of the static droplets;
[0299] multiplying the displacement map of the static droplets with the droplet distribution mask, and performing an integer operation on a multiplication result to obtain the droplet mask.
[0300] In an optional implementation, the target liquid mask includes a liquid flow mask corresponding to the flowing liquid, and the processor is configured to generate the liquid flow mask by the following method:
[0301] configuring a flow map in a liquid distribution map associated with the target model to obtain an initial flow mask corresponding to the flowing liquid in the liquid distribution map; wherein the liquid distribution map is used to represent a distribution range of the flowing liquid on the surface of the target model; the flow map includes a liquid bead image and a liquid tail image of the flowing liquid.
[0302] configure a time control function for the flow map in the initial flow mask, to obtain a first liquid flow mask corresponding to the flow liquid; wherein the time control function is used to control the UV coordinates of each point in the flow map to be offset in the vertical direction with time;
[0303] obtain the liquid flow mask based on the first liquid flow mask and the liquid distribution map.
[0304] In an optional implementation, when the liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, the processor 901 is configured to:
[0305] multiply the first liquid flow mask and the liquid distribution map to obtain the liquid flow mask.
[0306] In an optional implementation, when the liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, the processor is configured to:
[0307] When the liquid distribution map contains multiple flow liquids, the multiple flow liquids are grouped, and the flow channels corresponding to the flow liquids in the same group are configured with the same gray value to obtain an offset map corresponding to the flow liquids; wherein the flow channels corresponding to the flow liquids in different groups are configured with different gray values.
[0308] superimpose the offset map on the UV coordinates of each point in the first liquid flow mask to obtain a second liquid flow mask corresponding to the flow liquid;
[0309] multiply the second liquid flow mask and the liquid distribution map to obtain the liquid flow mask.
[0310] In an optional implementation, when the liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, the processor is configured to:
[0311] When the liquid distribution map contains multiple flow liquids, the multiple flow liquids are grouped, and the flow channels corresponding to the flow liquids in the same group are configured with the same gray value to obtain an offset map corresponding to the flow liquids; wherein the flow channels corresponding to the flow liquids in different groups are configured with different gray values.
[0312] multiply the offset map and a flow velocity parameter to obtain a target offset map; wherein the flow velocity parameter is used to represent the corresponding flow velocity of the flow liquid in the flow channel;
[0313] superimpose the target offset map on the UV coordinates of each point in the first liquid flow mask to obtain a third liquid flow mask corresponding to the flow liquid;
[0314] multiply the third liquid flow mask with the liquid distribution map to obtain the liquid flow mask.
[0315] In an alternative embodiment, the target liquid mask comprises a liquid flow mask corresponding to the flow liquid, and the processor is configured to generate the liquid flow mask by:
[0316] controlling the flow liquid in the liquid distribution map to flow in the vertical direction over time according to the liquid distribution map associated with the target model to obtain a plurality of liquid flow image frames corresponding to different time control nodes;
[0317] sequencing the plurality of liquid flow image frames in the node time order of the time control nodes to obtain a sequenced liquid flow image sequence as the liquid flow mask.
[0318] In an alternative embodiment, the target liquid mask comprises a liquid droplet mask corresponding to the static liquid droplet and a liquid flow mask corresponding to the flow liquid, and when superimposing the replacement map of the target liquid on the target liquid mask according to the target liquid corresponding to the target liquid mask, the processor is configured to:
[0319] multiply the target liquid mask with the replacement map of the static liquid droplet to obtain a first to-be-processed mask;
[0320] multiply the target liquid mask with the replacement map of the flow liquid to obtain a second to-be-processed mask;
[0321] mix the first to-be-processed mask and the second to-be-processed mask by a mixing brightening function to obtain the first liquid mask.
[0322] In an alternative embodiment, when determining a raised area distributed on the surface of the target model from the target model rendered based on the first liquid mask, the processor is configured to:
[0323] after rendering the target model based on the first liquid mask, for a grid point on the surface of the rendered target model, determining whether the grid point is distributed at an edge position of the surface of the target model according to a dot product result of a vector between a normal direction of the grid point and a camera view direction;
[0324] if the grid point is distributed at the edge position, determining that a grid area to which the grid point belongs belongs to the raised area.
[0325] In an optional implementation, the processor is further configured to:
[0326] In a case where the target liquid mask is replaced by the first liquid mask, determine an edge protrusion degree of the target liquid on the surface of the target model from the target model rendered based on the first liquid mask;
[0327] adjust a displacement strength parameter corresponding to a displacement map of the target liquid according to the edge protrusion degree, and perform parameter updating on the first liquid mask based on the displacement map of the target liquid after adjustment to obtain a second liquid mask;
[0328] re-render a liquid effect of the surface of the target model according to the second liquid mask.
[0329] In an optional implementation, after the second liquid mask is obtained, the processor is further configured to:
[0330] determine a target local area from the second liquid mask, and configure a target vector for representing a gravity effect for the target local area to obtain a third liquid mask; the target local area includes a first distribution area corresponding to the static droplet and / or a liquid aggregation area in the flowing liquid;
[0331] re-render a liquid effect of the surface of the target model according to the third liquid mask.
[0332] In an optional implementation, when the liquid effect of the surface of the target model is re-rendered according to the first liquid mask, the processor is configured to:
[0333] superimpose the first liquid mask on a base material associated with the target model by linear interpolation to obtain a composite material;
[0334] render the target model according to the composite material to obtain a target model with the liquid effect displayed on the surface of the model.
[0335] Through the computer-readable storage medium provided in the embodiment of the present application, a target liquid mask for rendering and displaying a liquid effect on the surface of a target model is obtained; based on the target liquid corresponding to the target liquid mask, a displacement map of the target liquid is superimposed on the target liquid mask to obtain a first liquid mask; under the condition that the target liquid mask is replaced with the first liquid mask, raised areas distributed on the surface of the target model are determined from the target model rendered based on the first liquid mask; the tessellation multiplier configured for the raised areas is increased to the first tessellation multiplier, and under the condition that the first tessellation multiplier is configured for the raised areas, the liquid effect on the surface of the target model is re-rendered and displayed based on the first liquid mask. In this way, the present application supports the presentation of liquid effects on multiple shading models such as the subsurface scattering shading model, so that the presentation of liquid effects is not restricted by the type of shading model. At the same time, the liquid effect rendered and displayed on the model surface can be quickly and conveniently adjusted by modifying material attribute parameters such as the tessellation multiplier, effectively improving the control efficiency of the liquid effect and the authenticity of the liquid effect.
[0336] In an embodiment of the present application, the computer-readable storage medium can also execute other machine-readable instructions when run by the processor to execute the control method of the liquid effect on the model surface as described in other embodiments. For the specific execution steps and principles of the control method, please refer to the description of the method side embodiment, which will not be repeated here.
[0337] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. The system embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. There may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some communication interface, indirect coupling or communication connection of the system or unit, which may be electrical, mechanical or other forms.
[0338] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0339] In addition, each functional unit in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0340] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and various program code storage media.
[0341] It should be noted that similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. In addition, the terms "first", "second", "third" and the like are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0342] Finally, it should be noted that the above-described embodiments are only specific implementations of the present application, which are used to illustrate the technical solutions of the present application, but not to limit them. The protection scope of the present application is not limited thereto. Although the present application 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 modify or easily think of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present application, or make equivalent replacements to some of the technical features. These modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method of controlling the effect of a liquid on a model surface, characterized by, The control method comprises: acquiring a target liquid mask for rendering and displaying a liquid effect on a target model surface; superimposing a displacement map of a target liquid on the target liquid mask according to a target liquid corresponding to the target liquid mask, to obtain a first liquid mask; wherein the target liquid comprises static droplets and / or flowing liquid; determining a raised area distributed on the target model surface from the target model rendered based on the first liquid mask, under the condition that the target liquid mask is replaced by the first liquid mask; increasing a surface subdivision multiplier configured for the raised area to a first surface subdivision multiplier, and re-rendering a liquid effect of the target model surface according to the first liquid mask under the condition that the first surface subdivision multiplier is configured for the raised area.
2. The control method according to claim 1, characterized by, The target liquid mask comprises a droplet mask corresponding to the static droplets, and the droplet mask is generated by the following method: acquiring a droplet map of the static droplets and a droplet distribution mask associated with the target model; wherein the droplet distribution mask is used to represent the distribution range of the static droplets on the target model surface; performing Gaussian blur processing on the droplet map of the static droplets to obtain a displacement map of the static droplets; multiplying the displacement map of the static droplets and the droplet distribution mask, and performing integer operation on the multiplication result to obtain the droplet mask.
3. The control method according to claim 1, characterized by, The target liquid mask comprises a liquid flow mask corresponding to the flowing liquid, and the liquid flow mask is generated by the following method: configuring a flow map for the flowing liquid included in a liquid distribution map associated with the target model according to the liquid distribution map, to obtain an initial flow mask corresponding to the flowing liquid; wherein the liquid distribution map is used to represent the distribution range of the flowing liquid on the target model surface; the flow map includes liquid bead images and liquid tail images of the flowing liquid; configuring a time control function for the flow map in the initial flow mask to obtain a first liquid flow mask corresponding to the flowing liquid; wherein the time control function is used to control the UV coordinates of each point in the flow map to offset in the vertical direction over time; obtaining the liquid flow mask based on the first liquid flow mask and the liquid distribution map.
4. The method of claim 3, wherein, The liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, comprising: multiplying the first liquid flow mask and the liquid distribution map to obtain the liquid flow mask.
5. The control method according to claim 3, characterized by, The liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, comprising: when the liquid distribution map includes multiple flowing liquids, grouping the multiple flowing liquids, and configuring the flow channels corresponding to the flowing liquids in the same group with the same gray value to obtain an offset map corresponding to the flowing liquids; wherein the gray values configured for the flow channels corresponding to the flowing liquids in different groups are different; superimpose the offset map on the UV coordinates of each point in the first liquid flow mask to obtain a second liquid flow mask corresponding to the flow liquid; multiply the second liquid flow mask and the liquid distribution map to obtain the liquid flow mask.
6. The control method according to claim 3, characterized by The liquid flow mask is obtained based on the first liquid flow mask and the liquid distribution map, including: When the liquid distribution map contains multiple flow liquids, the multiple flow liquids are grouped, and the flow channels corresponding to the flow liquids in the same group are configured with the same gray value to obtain an offset map corresponding to the flow liquid; wherein the flow channels corresponding to the flow liquids in different groups are configured with different gray values; multiply the offset map and the flow speed parameter to obtain a target offset map; wherein the flow speed parameter is used to represent the corresponding flow speed of the flow liquid in the flow channel; superimpose the target offset map on the UV coordinates of each point in the first liquid flow mask to obtain a third liquid flow mask corresponding to the flow liquid; multiply the third liquid flow mask and the liquid distribution map to obtain the liquid flow mask.
7. The control method according to claim 1, characterized by, The liquid flow mask corresponding to the flow liquid in the target liquid mask is generated by the following method: According to the liquid distribution map associated with the target model, control the flow liquid in the liquid distribution map to flow in the vertical direction with time to obtain a plurality of liquid flow image frames corresponding to different time control nodes; According to the node time sequence of the time control node, sort the plurality of liquid flow image frames to obtain a sorted liquid flow image sequence as the liquid flow mask.
8. The control method according to claim 1, characterized by, The target liquid mask contains a liquid drop mask corresponding to the static liquid drop and a liquid flow mask corresponding to the flow liquid, and the replacement map of the target liquid is superimposed on the target liquid mask according to the target liquid corresponding to the target liquid mask, including: multiply the target liquid mask and the replacement map of the static liquid drop to obtain a first to-be-processed mask; multiply the target liquid mask and the replacement map of the flow liquid to obtain a second to-be-processed mask; mix the first to-be-processed mask and the second to-be-processed mask by a mixing lightening function to obtain the first liquid mask.
9. The control method according to claim 1, characterized by, The convex region distributed on the surface of the target model is determined from the target model rendered based on the first liquid mask, including: After rendering the target model based on the first liquid mask, for the grid points on the surface of the rendered target model, according to the dot product result of the normal direction of the grid point and the camera view direction, it is judged whether the grid point is distributed on the edge position of the target model surface; If the grid point is distributed on the edge position, it is determined that the grid region to which the grid point belongs belongs to the convex region.
10. The control method according to claim 1, characterized by, The control method further comprises: determine, from the target model rendered based on the first liquid mask, a degree of edge protrusion of the target liquid on the surface of the target model, under a condition that the target liquid mask is replaced by the first liquid mask; adjust a displacement strength parameter corresponding to a displacement map of the target liquid according to the degree of edge protrusion, and perform parameter updating on the first liquid mask based on the displacement map of the target liquid after adjustment, to obtain a second liquid mask; re-render a liquid effect of the surface of the target model according to the second liquid mask.
11. The control method according to claim 9, characterized by, After the second liquid mask is obtained, the control method further includes: determine a target local area from the second liquid mask, and configure a target vector for representing a gravity effect for the target local area, to obtain a third liquid mask; wherein the target local area includes a first distribution area corresponding to the static droplet and / or a liquid aggregation area in the flowing liquid; re-render a liquid effect of the surface of the target model according to the third liquid mask.
12. The control method according to claim 1, characterized by, The re-rendering of the liquid effect of the surface of the target model according to the first liquid mask includes: superimpose the first liquid mask on a base material associated with the target model by linear interpolation, to obtain a composite material; render the target model according to the composite material, to obtain a target model with the liquid effect displayed on the surface of the model.
13. A model surface liquid effect control device, characterized by, The control device includes: an acquisition module configured to acquire a target liquid mask for rendering a liquid effect on a surface of a target model; a mask making module configured to superimpose a displacement map of a target liquid on the target liquid mask, to obtain a first liquid mask, according to the target liquid corresponding to the target liquid mask; wherein the target liquid includes a static droplet and / or a flowing liquid; an adjustment module configured to determine a protruding area distributed on the surface of the target model from the target model rendered based on the first liquid mask, under a condition that the target liquid mask is replaced by the first liquid mask; a rendering module configured to increase a tessellation multiplier configured for the protruding area to a first tessellation multiplier, and re-render a liquid effect of the surface of the target model according to the first liquid mask, under a condition that the first tessellation multiplier is configured for the protruding area.
14. An electronic device, comprising: include: a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, the machine readable instructions are executed by the processor to perform the steps of the model surface liquid effect control method in any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, which is executed by the processor to perform the steps of the model surface liquid effect control method in any one of claims 1 to 12.