Target fluid rendering method, device, storage medium and electronic device
By determining fluid and solid terrain information through sampling points and generating a flow map, the method improves virtual reality water effects in game scenes while reducing costs.
Patent Information
- Application Number
- CN202210668116.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-14
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-06-14
AI Technical Summary
Existing methods for creating water effects in virtual game scenes, such as using water bodies without interactive information or pre-designed flow maps, result in poor virtual reality effects, high costs, and inability to depict water flow interaction with terrain.
A method involving obtaining sampling points on a virtual terrain model, determining fluid and solid terrain information based on connectivity relationships, and generating a flow map using this information to render water effects, thereby improving virtual reality without high costs.
Enhances virtual reality effects of water bodies in game scenes by accurately depicting flow interaction with terrain at a lower cost compared to traditional methods.
Smart Images

Figure CN115120972B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a target fluid rendering method, device, storage medium and electronic device. Background Art
[0002] At present, since water information is difficult to fit in virtual game scenes, water effects usually do not exist or rarely exist in mobile game scenes. There are mainly two methods for making water effects in related technologies.
[0003] The first method is to directly use water bodies with consistent flow directions and no interactive information to display in the corresponding area. However, the disadvantages of this method are: poor virtual reality effect, lack of detail expression, and inability to reflect the effect of water flow changing with terrain.
[0004] The second method is to use the Flow Map created by the artists to show the direction of water flow, and then get the water effect in the game scene. However, the defects of this method are: high art design cost; too much texture data used to record the flow of water, high operating cost; poor virtual reality effect, can only show the direction of water flow but not the speed of water flow.
[0005] To address the above-mentioned problems, no effective solution has been proposed yet.
[0006] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0007] The embodiments of the present invention provide a target fluid rendering method, device, storage medium and electronic device to at least solve the technical problems in the related art of relying on water bodies without interactive information or pre-designed flow maps to produce water bodies, which have high costs and poor virtual reality effects.
[0008] According to one aspect of an embodiment of the present invention, a target fluid rendering method is provided, comprising:
[0009] A plurality of first sampling points and a plurality of second sampling points are obtained on a virtual terrain model of a game scene, wherein the plurality of first sampling points are located in a first terrain region, the plurality of second sampling points are located in a second terrain region, the first terrain region is a fluid terrain region, and the second terrain region is a solid terrain region; first fluid information of the plurality of first sampling points is obtained based on a connectivity relationship between the plurality of first sampling points, wherein the first fluid information is used to determine a flow velocity and a direction corresponding to each of the plurality of first sampling points; second fluid information of the plurality of second sampling points is obtained through the first fluid information, wherein the second fluid information is used to determine a flow velocity and a direction corresponding to each of the plurality of second sampling points; and a flow map is generated using the first fluid information and the second fluid information to render and display a target fluid in the first terrain region.
[0010] Optionally, obtaining multiple first sampling points and multiple second sampling points on the virtual terrain model of the game scene includes: sampling multiple virtual plots contained in the virtual terrain model to obtain multiple plot sampling points; and dividing the multiple plot sampling points into multiple first sampling points and multiple second sampling points according to the type of each plot sampling point in the multiple plot sampling points.
[0011] Optionally, the multiple virtual plots include: multiple first plots and multiple second plots, the multiple first plots are located in a first terrain area, and the multiple second plots are located in a boundary area between the first terrain area and the second terrain area. The method also includes: obtaining, from the multiple first plots and the multiple second plots, the belonging plot of each plot sampling point in the multiple plot sampling points and the position information of each plot sampling point in the belonging plot; and determining the type of each plot sampling point based on the belonging plot and the position information.
[0012] Optionally, determining the type of each plot sampling point based on the belonging plot and the position information includes: selecting a target sampling point from multiple plot sampling points; in response to the belonging plot of the target sampling point being any plot among multiple first plots, determining the target sampling point to be a fluid type sampling point; in response to the belonging plot of the target sampling point being any plot among multiple second plots and determining based on the position information that the target sampling point is located in a first terrain area, determining the target sampling point to be a fluid type sampling point; in response to the belonging plot of the target sampling point being any plot among multiple second plots and determining based on the position information that the target sampling point is located in a second terrain area, determining the target sampling point to be a solid type sampling point.
[0013] Optionally, obtaining the first fluid information of the multiple first sampling points based on the connectivity relationship between the multiple first sampling points includes: searching for adjacent sampling points of each of the multiple first sampling points from multiple directions, and establishing a connection between each first sampling point and the found adjacent sampling points to obtain a connectivity relationship; based on the connectivity relationship, selecting a fluid source from the multiple first sampling points; calculating a depth value of each third sampling point in the multiple third sampling points relative to the fluid source, wherein the multiple third sampling points are the remaining sampling points in the multiple first sampling points except the fluid source; and obtaining the first fluid information using the depth value.
[0014] Optionally, obtaining the first fluid information using the depth value includes: determining in sequence whether each of the multiple third sampling points has an adjacent sampling point with a higher depth value; in response to the existence of adjacent sampling points with higher depth values in multiple directions, generating a first vector between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value, wherein the first vector is used to determine the flow rate and direction of the target fluid between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value; in response to the absence of adjacent sampling points with a higher depth value in multiple directions, generating a second vector between two adjacent third sampling points with the same depth value, wherein the second vector is used to determine the flow rate and direction of the target fluid between the two adjacent third sampling points with the same depth value; and determining all subsequent sampling points to be passed by each of the multiple third sampling points based on the first vector and the second vector to obtain the first fluid information.
[0015] Optionally, the length of the input vector connected to each third sampling point among the plurality of third sampling points is equal to the length of the output vector connected to the third sampling point.
[0016] Optionally, acquiring the second fluid information of the plurality of second sampling points through the first fluid information includes: searching for a third sampling point adjacent to each of the plurality of second sampling points from multiple directions; and acquiring the second fluid information using the found third sampling points.
[0017] Optionally, obtaining the second fluid information using the found third sampling point includes: obtaining the length of the output vector connected to each second sampling point using the length of the output vector connected to the found third sampling point; obtaining the direction of the output vector connected to each second sampling point using the relative position relationship between each second sampling point and the found third sampling point; and determining the second fluid information based on the output vector length and the output vector direction.
[0018] Optionally, using the first fluid information and the second fluid information to generate a flow map includes: using the first fluid information and the second fluid information to determine target fluid information of multiple sampling points corresponding to each of multiple virtual plots included in the virtual terrain model; and in a shader corresponding to the target fluid, using the target fluid information to generate a flow map.
[0019] According to another aspect of an embodiment of the present invention, a target fluid rendering device is provided, comprising:
[0020] The first acquisition module is used to acquire a plurality of first sampling points and a plurality of second sampling points on a virtual terrain model of a game scene, wherein the plurality of first sampling points are located in a first terrain region, and the plurality of second sampling points are located in a second terrain region, the first terrain region is a fluid terrain region, and the second terrain region is a solid terrain region; the second acquisition module is used to acquire first fluid information of the plurality of first sampling points based on a connectivity relationship between the plurality of first sampling points, wherein the first fluid information is used to determine a flow velocity and a direction corresponding to each of the plurality of first sampling points; the third acquisition module is used to acquire second fluid information of the plurality of second sampling points through the first fluid information, wherein the second fluid information is used to determine a flow velocity and a direction corresponding to each of the plurality of second sampling points; the rendering module is used to generate a flow map using the first fluid information and the second fluid information to render and display the target fluid in the first terrain region.
[0021] Optionally, the first acquisition module is further used to: sample multiple virtual plots included in the virtual terrain model to obtain multiple plot sampling points; and divide the multiple plot sampling points into multiple first sampling points and multiple second sampling points according to the type of each plot sampling point in the multiple plot sampling points.
[0022] Optionally, the multiple virtual plots include: multiple first plots and multiple second plots, the multiple first plots are located in the first terrain area, and the multiple second plots are located in the boundary area between the first terrain area and the second terrain area. The target fluid rendering device also includes: a determination module, used to obtain the belonging plot of each plot sampling point in the multiple plot sampling points and the position information of each plot sampling point in the belonging plot from the multiple first plots and the multiple second plots; determine the type of each plot sampling point based on the belonging plot and the position information.
[0023] Optionally, the above-mentioned determination module is also used to: select a target sampling point from multiple land plot sampling points; in response to the land plot to which the target sampling point belongs being any of multiple first land plots, determine the target sampling point as a fluid type sampling point; in response to the land plot to which the target sampling point belongs being any of multiple second land plots and the target sampling point being determined to be located in the first terrain area based on the position information, determine the target sampling point as a fluid type sampling point; in response to the land plot to which the target sampling point belongs being any of multiple second land plots and the target sampling point being determined to be located in the second terrain area based on the position information, determine the target sampling point as a solid type sampling point.
[0024] Optionally, the second acquisition module is further used to: search for adjacent sampling points of each of the multiple first sampling points from multiple directions, and establish a connection between each first sampling point and the found adjacent sampling points to obtain a connectivity relationship; based on the connectivity relationship, select a fluid source from the multiple first sampling points; calculate a depth value of each of the multiple third sampling points relative to the fluid source, wherein the multiple third sampling points are the remaining sampling points of the multiple first sampling points except the fluid source; and obtain the first fluid information using the depth value.
[0025] Optionally, the second acquisition module is further used to: sequentially determine whether there is an adjacent sampling point with a higher depth value for each of the multiple third sampling points; in response to the existence of adjacent sampling points with higher depth values in multiple directions, generate a first vector between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value, wherein the first vector is used to determine the flow rate and direction of the target fluid between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value; in response to the absence of adjacent sampling points with a higher depth value in multiple directions, generate a second vector between two adjacent third sampling points with the same depth value, wherein the second vector is used to determine the flow rate and direction of the target fluid between two adjacent third sampling points with the same depth value; and determine all subsequent sampling points to be passed by each of the multiple third sampling points based on the first vector and the second vector to obtain the first fluid information.
[0026] Optionally, the third acquisition module is further used to: search for a third sampling point adjacent to each of the multiple second sampling points from multiple directions; and acquire the second fluid information using the found third sampling points.
[0027] Optionally, the third acquisition module is further used to: obtain the length of the output vector connected to each second sampling point using the length of the output vector connected to the found third sampling point; obtain the direction of the output vector connected to each second sampling point using the relative position relationship between each second sampling point and the found third sampling point; and determine the second fluid information based on the output vector length and the output vector direction.
[0028] Optionally, the rendering module is further used to: use the first fluid information and the second fluid information to determine target fluid information of multiple sampling points corresponding to each virtual plot in the virtual terrain model; and use the target fluid information to generate a flow map in a shader corresponding to the target fluid.
[0029] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute any of the above target fluid rendering methods when running.
[0030] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute any of the above target fluid rendering methods.
[0031] In at least some embodiments of the present invention, by obtaining a plurality of first sampling points and a plurality of second sampling points on a virtual terrain model of a game scene, and obtaining first fluid information of the plurality of first sampling points based on the connectivity relationship between the plurality of first sampling points, further obtaining second fluid information of the plurality of second sampling points through the first fluid information, and rendering and displaying a target fluid in a first terrain region by generating a flow map using the first fluid information and the second fluid information, the purpose of determining corresponding fluid information through sampling points on the fluid region and the terrain region to generate a flow map and a target fluid is achieved, thereby achieving the technical effect of improving the virtual reality effect of water body production in a virtual game scene at a relatively low cost, and further solving the technical problem of high cost and poor virtual reality effect of the method of producing water body in the related art relying on water body without interactive information or pre-designed flow map. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0033] Figure 1 is a schematic diagram of an optional flow map splicing result according to the related art;
[0034] Figure 2 It is a hardware structure block diagram of a mobile terminal of a target fluid rendering method according to an embodiment of the present invention;
[0035] Figure 3 is a flow chart of a target fluid rendering method according to an embodiment of the present invention;
[0036] Figure 4is a schematic diagram of an optional virtual land plot sampling result according to an embodiment of the present invention;
[0037] Figure 5 is a schematic diagram of another optional virtual land plot sampling result according to an embodiment of the present invention;
[0038] Figure 6 is a schematic diagram of an optional sampling point connectivity relationship according to an embodiment of the present invention;
[0039] Figure 7 is a schematic diagram of an optional sampling point depth value distribution according to an embodiment of the present invention;
[0040] Figure 8 is a schematic diagram of an optional fluid information determination process according to an embodiment of the present invention;
[0041] Fig. 9 is a schematic diagram of another optional fluid information determination process according to an embodiment of the present invention;
[0042] Fig.10 is a schematic diagram of another optional fluid information determination process according to an embodiment of the present invention;
[0043] Fig.11 is a schematic diagram of an optional fluid information determination result according to an embodiment of the present invention;
[0044] Fig.12 is a structural block diagram of a target fluid rendering device according to an embodiment of the present invention;
[0045] Fig.13 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0047] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0048] In response to the current problem that water body information is difficult to fit in virtual game scenes, the methods for producing water body effects in related technologies mainly include: using water bodies without interactive information and producing by drawing Flow Maps. Among them, water bodies without interactive information appear to have consistent flow directions in virtual game scenes, and the effect is poor.
[0049] When creating water effects in a virtual game scene by drawing a Flow Map, an artist draws a corresponding Flow Map for each of multiple virtual plots, and splices the multiple Flow Maps. Figure 1 is a schematic diagram of an optional flow map splicing result according to the related art, such as Figure 1 As shown, since plots A, B, and C are located in the corners of the map, their display effect is usually poor in the stitching results.
[0050] However, the water effect created by pre-drawing the Flow Map cannot show the flow velocity of the water, nor the interaction between the water and the solid terrain. Therefore, artists need to manually edit the water velocity in the pre-made Flow Map, which is cumbersome and costly.
[0051] In addition, in virtual game scenes, the map size is usually large, and the map contains a large number of virtual plots. If a corresponding Flow Map is drawn for each virtual plot, the amount of data in the game resource package will be very large and the operating cost will be very high.
[0052] In view of the above problems, the method provided by the present invention can be used as an effective solution.
[0053] According to one embodiment of the present invention, an embodiment of a target fluid rendering method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0054] In one embodiment of the present invention, the target fluid rendering method can be run on a terminal device or a server. The terminal device can be a local terminal device. When the target fluid rendering method is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0055] In an optional embodiment, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the running body of the game program and the game screen presentation body are separated. The storage and operation of the target fluid rendering method are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the terminal device for information processing is a cloud game server in the cloud. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0056] In an optional embodiment, the terminal device may be a local terminal device. Taking a game as an example, the local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0057] In a possible implementation, an embodiment of the present invention provides a target fluid rendering method, which provides a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or can be a client device in the cloud interaction system mentioned above.
[0058] Taking a mobile terminal running in a local terminal device as an example, the mobile terminal can be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, referred to as MID), a PAD, a game console, and other terminal devices. Figure 2 1 is a hardware structure block diagram of a mobile terminal of a target fluid rendering method according to an embodiment of the present invention. Figure 2 As shown, the mobile terminal may include one or more ( Figure 2 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a programmable logic device (FPGA), a neural network processor (NPU), a tensor processor (TPU), an artificial intelligence (AI) type processor, etc.) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 for communication functions, an input and output device 108, and a display device 110. It can be understood by those skilled in the art that Figure 2 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 2 More or fewer components as shown, or with Figure 2 Different configurations are shown.
[0059] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the target fluid rendering method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the target fluid rendering method described above is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0060] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0061] The inputs in the input / output device 108 may come from a plurality of human interface devices (HIDs), such as keyboards and mice, game controllers, and other dedicated game controllers (such as steering wheels, fishing rods, dance mats, remote controls, etc.). In addition to providing input functions, some human interface devices may also provide output functions, such as force feedback and vibration of game controllers, audio output of controllers, etc.
[0062] The display device 110 may be, for example, a head-up display (HUD), a touch-screen liquid crystal display (LCD), and a touch display (also referred to as a "touch screen" or "touch display screen"). The liquid crystal display may enable a user to interact with a user interface of the mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), and a user may interact with the GUI by finger contacts and / or gestures on a touch-sensitive surface, wherein the human-computer interaction functions here may optionally include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. The executable instructions for executing the above-mentioned human-computer interaction functions are configured / stored in a computer program product or a readable storage medium executable by one or more processors.
[0063] In this embodiment, a target fluid rendering method running on the above mobile terminal is provided. Figure 3 is a flow chart of a target fluid rendering method according to one embodiment of the present invention. Figure 3 As shown, the method comprises the following steps:
[0064] Step S31, acquiring a plurality of first sampling points and a plurality of second sampling points on a virtual terrain model of a game scene, wherein the plurality of first sampling points are located in a first terrain region, the plurality of second sampling points are located in a second terrain region, the first terrain region is a fluid terrain region, and the second terrain region is a solid terrain region;
[0065] The virtual terrain model may be a virtual surface in a game scene, and may include at least fluid terrain areas (such as rivers, lakes, oceans, etc.) and solid terrain areas (such as riverbanks, beaches, green land, reefs, etc.).
[0066] In the fluid terrain area of the virtual terrain model, the plurality of first sampling points may be obtained; and in the solid terrain area of the virtual terrain model, the plurality of second sampling points may be obtained.
[0067] Specifically, obtaining a plurality of first sampling points and a plurality of second sampling points on the virtual terrain model of the game scene also includes other method steps, which can be referred to the further introduction of the embodiment of the present invention below and will not be described in detail here.
[0068] Step S32, acquiring first fluid information of the plurality of first sampling points based on the connectivity relationship between the plurality of first sampling points, wherein the first fluid information is used to determine the flow velocity and direction corresponding to each of the plurality of first sampling points;
[0069] The connectivity relationship between the plurality of first sampling points may be a connectivity relationship established according to the position of each of the plurality of first sampling points.
[0070] The plurality of first sampling points are a plurality of sampling points obtained from the fluid terrain area of the virtual terrain model. The first fluid information can be used to determine the flow velocity and direction corresponding to each of the first sampling points.
[0071] Based on the connectivity relationship between the plurality of first sampling points, the first fluid information of the plurality of first sampling points can be obtained. The first fluid information can be used to produce a fluid effect.
[0072] Specifically, obtaining the first fluid information of the plurality of first sampling points based on the connectivity relationship between the plurality of first sampling points also includes other method steps, which may be referred to in the further introduction of the embodiments of the present invention below and will not be described in detail here.
[0073] Step S33, obtaining second fluid information of a plurality of second sampling points through the first fluid information, wherein the second fluid information is used to determine the flow velocity and direction corresponding to each of the plurality of second sampling points;
[0074] The plurality of second sampling points are a plurality of sampling points obtained from a solid terrain area of a virtual terrain model. The first fluid information can be used to determine the flow velocity and direction corresponding to each of the first sampling points. The second fluid information of the plurality of second sampling points can be obtained through the first fluid information. The second fluid information can be used to determine the flow velocity and direction corresponding to each of the plurality of second sampling points. The second fluid information can be used to produce a fluid effect.
[0075] Specifically, obtaining the second fluid information of the plurality of second sampling points through the first fluid information also includes other method steps, which can be referred to in the further introduction of the embodiments of the present invention below and will not be described in detail here.
[0076] Step S34, using the first fluid information and the second fluid information to generate a flow map to render and display the target fluid in the first terrain area.
[0077] The flow map may be a map for storing flow information corresponding to the target fluid. The target fluid in the fluid terrain area may be rendered and displayed according to the flow map through a preset game engine.
[0078] It should be noted that the above-mentioned flow map is generated based on the flow information determined by the fluid sampling points (equivalent to the above-mentioned first fluid information) and the flow information determined by the solid sampling points (equivalent to the above-mentioned second fluid information), wherein the flow information determined based on the fluid sampling points can be used to determine the flow characteristics inside the target fluid, and the flow information determined based on the solid sampling points can be used to determine the flow characteristics caused by the external effect of the solid area (such as the shore) on the target fluid.
[0079] In actual application scenarios, the flow information determined by the corresponding fluid sampling points in the Flow map (equivalent to the above-mentioned first fluid information) is mainly used to determine the display boundary of the target fluid in the virtual scene. When using the Flow map for fluid rendering, the focus is on rendering the target fluid in the fluid terrain area (equivalent to the above-mentioned first terrain area). In other words, the method provided by the present invention does not limit the rendering method of the solid terrain area (equivalent to the above-mentioned second terrain area) in the virtual scene, and the rendering method of the solid terrain area (such as a beach, a river bank, etc.) can be any other feasible method. Specifically, the generation of the flow map using the first fluid information and the second fluid information also includes other method steps, which can be referred to the further introduction of the embodiments of the present invention below, and will not be repeated here.
[0080] In at least some embodiments of the present invention, by obtaining a plurality of first sampling points and a plurality of second sampling points on a virtual terrain model of a game scene, and obtaining first fluid information of the plurality of first sampling points based on the connectivity relationship between the plurality of first sampling points, further obtaining second fluid information of the plurality of second sampling points through the first fluid information, and rendering and displaying a target fluid in a first terrain region by generating a flow map using the first fluid information and the second fluid information, the purpose of determining corresponding fluid information through sampling points on the fluid region and the terrain region to generate a flow map and a target fluid is achieved, thereby achieving the technical effect of improving the virtual reality effect of water body production in a virtual game scene at a relatively low cost, and further solving the technical problem of high cost and poor virtual reality effect of the method of producing water body in the related art relying on water body without interactive information or pre-designed flow map.
[0081] The above method of this embodiment is further introduced below.
[0082] Optionally, in step S31, acquiring a plurality of first sampling points and a plurality of second sampling points on the virtual terrain model of the game scene may include the following execution steps:
[0083] Step S311, sampling multiple virtual plots included in the virtual terrain model to obtain multiple plot sampling points;
[0084] Step S312: dividing the plurality of land parcel sampling points into a plurality of first sampling points and a plurality of second sampling points according to the type of each land parcel sampling point in the plurality of land parcel sampling points.
[0085] The virtual terrain model may be a virtual surface in a game scene. The virtual terrain model may include multiple virtual plots. By sampling the multiple virtual plots, multiple plot sampling points may be obtained. In actual application scenarios, sampling may be uniform sampling, random sampling, specified rule sampling, etc. determined according to scenario requirements.
[0086] According to the type of each of the plurality of plot sampling points, the plurality of plot sampling points may be divided into a plurality of first sampling points and a plurality of second sampling points. The plurality of first sampling points may be sampling points sampled from a portion of the plurality of virtual plots belonging to a fluid terrain region. The plurality of second sampling points may be sampling points sampled from a portion of the plurality of virtual plots belonging to a solid terrain region.
[0087] Figure 4 is a schematic diagram of an optional virtual land parcel sampling result according to an embodiment of the present invention, such as Figure 4As shown, in the virtual game scene, there are a river area, a river bank area 1 and a river bank area 2. When designing the virtual terrain of the virtual game scene, the virtual terrain is usually divided into a plurality of virtual plots (in this example, rectangular virtual plots). By sampling the plurality of virtual plots in the virtual terrain, a plurality of plot sampling points can be obtained.
[0088] Optionally, the plurality of virtual plots include: a plurality of first plots and a plurality of second plots, the plurality of first plots are located in a first terrain region, and the plurality of second plots are located in a boundary region between the first terrain region and the second terrain region, and the target fluid rendering method further includes:
[0089] Step S35, obtaining, from the plurality of first plots and the plurality of second plots, the belonging plot of each plot sampling point among the plurality of plot sampling points and the position information of each plot sampling point in the belonging plot;
[0090] Step S36, determining the type of each land parcel sampling point based on the land parcel and location information.
[0091] The plurality of first plots are plots within the fluid terrain region, and the plurality of second plots are plots in the boundary region between the fluid terrain region and the solid terrain region.
[0092] The above-mentioned multiple plot sampling points are sampling points obtained by sampling multiple virtual plots included in the virtual surface in the game scene.
[0093] From the plurality of first plots and the plurality of second plots, the belonging plot of each plot sampling point in the plurality of plot sampling points and the position information of each plot sampling point in the belonging plot can be obtained. The belonging plot of the plot sampling point can be the plot identifier corresponding to the plot sampling point. The position information of the plot sampling point in the belonging plot can be the relative position coordinate information of the plot sampling point in the belonging plot.
[0094] Optionally, in step S36, determining the type of each land parcel sampling point based on the land parcel and the location information may include the following execution steps:
[0095] Step S361, selecting a target sampling point from a plurality of plot sampling points;
[0096] Step S362, in response to the belonging plot of the target sampling point being any plot among the plurality of first plots, determining the target sampling point to be a fluid type sampling point;
[0097] Step S363, in response to the belonging plot of the target sampling point being any plot of the plurality of second plots and the target sampling point being determined to be located in the first terrain area based on the position information, determining the target sampling point to be a fluid type sampling point;
[0098] Step S364 , in response to the target sampling point belonging to any of the plurality of second plots and the target sampling point being determined to be located in the second terrain area based on the position information, the target sampling point is determined to be a solid type sampling point.
[0099] Figure 5 is a schematic diagram of another optional virtual land parcel sampling result according to an embodiment of the present invention, such as Figure 5 As shown, according to whether the multiple plot sampling points belong to the river area or the river bank area (including river bank area 1 and river bank area 2), the multiple plot sampling points can be divided into first sampling points (plot sampling points belonging to the river area) and second sampling points (plot sampling points belonging to the river bank area). It should be noted that for the virtual terrain in the virtual scene, the categories of the multiple virtual plots in the virtual terrain (such as river, river bank, etc.) can be determined through the height information map or height information interface corresponding to the virtual terrain.
[0100] Still like Figure 5 As shown, the plurality of plots may include boundary plots and fluid plots, wherein the boundary plots are as follows: Figure 5 The boundary plots 1, 2, ..., 8 shown in FIG. , the fluid plots are as follows Figure 5 All plots except the boundary plots shown in .
[0101] Still like Figure 5 As shown, according to the above 8 boundary plots and multiple fluid plots, the belonging plot of each plot sampling point in the multiple plot sampling points and the position information of each plot sampling point in the belonging plot can be obtained. The position information can be the identification information of the nine positions including the center point corresponding to the eight connected regions (such as positions 1 to 9).
[0102] Still like Figure 5 As shown, according to the belonging plots and position information corresponding to the multiple sampling points, the category of each sampling point in the multiple sampling points can be determined in turn.
[0103] Specifically, when the land parcel corresponding to the target sampling point selected from the plurality of land parcel sampling points belongs to the plurality of first land parcels (such as Figure 5 When other plots except the boundary plots, namely the fluid plots, are selected, the target sampling point can be determined as a fluid type sampling point.
[0104] Specifically, when the land parcel corresponding to the target sampling point selected from the plurality of land parcel sampling points belongs to the plurality of second land parcels (such as Figure 5 and the target sampling point is located in the fluid terrain area according to the position information of the target sampling point in the belonging plot. Figure 5 The first sampling point belonging to the boundary plot in the figure is determined as the fluid type sampling point.
[0105] Specifically, when the land parcel corresponding to the target sampling point selected from the plurality of land parcel sampling points belongs to the plurality of second land parcels (such as Figure 5 and the target sampling point is located in the solid terrain area according to the position information of the target sampling point in the belonging plot. Figure 5 The second sampling point belonging to the boundary plot) is determined as a solid type sampling point.
[0106] Optionally, in step S32, acquiring the first fluid information of the plurality of first sampling points based on the connectivity relationship between the plurality of first sampling points may include the following execution steps:
[0107] Step S321, searching for adjacent sampling points of each of the multiple first sampling points from multiple directions, and establishing a connection between each first sampling point and the searched adjacent sampling points to obtain a connectivity relationship;
[0108] Step S322, selecting a fluid source from a plurality of first sampling points based on the connectivity relationship;
[0109] Step S323, calculating the depth value of each third sampling point in a plurality of third sampling points relative to the fluid source, wherein the plurality of third sampling points are the remaining sampling points in the plurality of first sampling points except the fluid source;
[0110] Step S324: obtaining first fluid information using the depth value.
[0111] The multiple directions may be eight directions (i.e., up, down, left, right, upper left, lower left, upper right, and lower right) corresponding to eight connected regions (also referred to as eight neighborhoods). Searching for adjacent sampling points of each of the multiple first sampling points from the eight directions may be based on each first sampling point, searching for the sampling point closest to the first sampling point in each direction of the multiple directions to obtain eight adjacent sampling points corresponding to the first sampling point.
[0112] The connectivity relationship can be obtained by connecting each of the plurality of first sampling points with the plurality of adjacent sampling points corresponding to the first sampling point. When the plurality of directions are eight directions corresponding to the eight-connected regions, the connectivity relationship can be an eight-connected relationship.
[0113] Based on the above connectivity relationship, a fluid source can be selected from multiple sampling points. The fluid source is used to represent the starting point of the fluid flow in the above fluid terrain area.
[0114] The above-mentioned multiple third sampling points can be the remaining sampling points of the above-mentioned multiple first sampling points except the fluid source. By calculating the depth value of each third sampling point in the multiple third sampling points relative to the fluid source, the depth value can be further used to obtain the above-mentioned first fluid information. The depth value can be used to indicate the distance between the third sampling point and the fluid source. The larger the depth value, the farther the distance. The first fluid information can be used to determine the flow velocity and direction corresponding to each first sampling point in the above-mentioned first sampling points.
[0115] Optionally, in step S324, obtaining the first fluid information by using the depth value may include the following execution steps:
[0116] Step S3241, determining in sequence whether each of the plurality of third sampling points has an adjacent sampling point with a higher depth value;
[0117] Step S3242, in response to the presence of adjacent sampling points with higher depth values in multiple directions, generating a first vector between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value, wherein the first vector is used to determine the flow velocity and direction of the target fluid between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value;
[0118] Step S3243, in response to the absence of adjacent sampling points with higher depth values in multiple directions, generating a second vector between two adjacent third sampling points with the same depth value, wherein the second vector is used to determine the flow velocity and direction of the target fluid between the two adjacent third sampling points with the same depth value;
[0119] Step S3244: determine all subsequent sampling points to be flowed through by each third sampling point in the plurality of third sampling points based on the first vector and the second vector, and obtain first fluid information.
[0120] The step of sequentially determining whether each of the plurality of third sampling points has an adjacent sampling point with a higher depth value may be: for each of the plurality of third sampling points, determining whether there is an adjacent sampling point with a higher depth value than the third sampling point among the plurality of adjacent sampling points of the third sampling point.
[0121] When there is an adjacent sampling point with a depth value higher than the third sampling point among the plurality of adjacent sampling points of the third sampling point, the first vector may be generated between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value. The first vector may be used to determine the flow velocity and flow direction of the target fluid between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value. The direction of the first vector may be from the lower third sampling point to the adjacent sampling point with a higher depth value.
[0122] It should be noted that, among the multiple adjacent sampling points of the third sampling point, there may be two or more adjacent sampling points with higher depth values. In this case, two or more first vectors can be generated, and the two or more first vectors are vectors from the third sampling point to the two or more adjacent sampling points with higher depth values.
[0123] When there is no adjacent sampling point with a depth value higher than that of the third sampling point among the plurality of adjacent sampling points of the third sampling point, the second vector may be generated between the third sampling point and another adjacent third sampling point with a depth value of the third sampling point. The second vector may be used to determine the flow velocity and direction of the target fluid between two adjacent third sampling points with the same depth value.
[0124] Based on the first vector and the second vector, all subsequent sampling points to be flowed through by each of the plurality of third sampling points can be determined, thereby obtaining first fluid information. The first fluid information can be used to determine the flow velocity and direction corresponding to each of the first sampling points.
[0125] Optionally, in the above target fluid rendering method, the length of an input vector connected to each third sampling point among the plurality of third sampling points is equal to the length of an output vector connected to the third sampling point.
[0126] The length of the input vector connected to the third sampling point is the length of the vector pointing to the third sampling point. The length of the output vector connected to the third sampling point is the length of the vector emitted by the third sampling point.
[0127] The length of the input vector connected to each of the multiple third sampling points is equal to the length of the output vector connected to the third sampling point, wherein the length of the input vector connected to the third sampling point may be the total length of at least one input vector connected to the third sampling point, and the length of the output vector connected to the third sampling point may be the total length of at least one output vector connected to the third sampling point.
[0128] Figure 6 is a schematic diagram of an optional sampling point connectivity relationship according to an embodiment of the present invention, in which adjacent first sampling points are searched for each first sampling point of the virtual terrain in the eight connectivity directions, and two first sampling points that have adjacent relationships are connected to establish a Figure 6 The connectivity relationship shown in FIG. This connectivity relationship can be used to represent candidate water flow paths in the river area of the virtual terrain.
[0129] Figure 7 FIG. 1 is a schematic diagram of an optional sampling point depth value distribution according to an embodiment of the present invention. Figure 6 and Figure 7As shown, among the multiple first sampling points, the first sampling point in the upstream of the river area (such as Figure 7 The first sampling point with a depth value of 0 shown in FIG. 1 is selected as the source of the river. The depth values of multiple first sampling points are determined based on the shortest connected paths between other first sampling points other than the source of the river and the source of the river. The distribution of the depth values of the first sampling points after determination is as follows: Figure 7 shown.
[0130] Optionally, the depth value of a first sampling point may be: determining the number of first sampling points passed in the shortest connected path from the first sampling point to the source of the river (including the source of the river but excluding the first sampling point). Figure 7 As shown, for the first sampling point with a depth value of 5, it takes at least 5 first sampling points to reach the source of the river.
[0131] Still like Figure 7 As shown, each of the other first sampling points (equivalent to the third sampling point) except the source of the river is taken as the center, and the adjacent first sampling points of the central first sampling point are analyzed in turn to see whether there are adjacent first sampling points with a depth value higher than the central first sampling point, to obtain analysis results. Then, the flow information (including flow direction and flow velocity) corresponding to the multiple first sampling points in the river area is determined according to the analysis results.
[0132] Specifically, Figure 8 is a schematic diagram of an optional fluid information determination process according to an embodiment of the present invention, such as Figure 8 As shown, by analyzing the first sampling point with a depth value of 3, it can be found that there are three first sampling points with a depth value of 4 among the adjacent first sampling points of the first sampling point. At this time, three first vectors (from the first sampling point with a depth value of 3 to the first sampling point with a depth value of 4) can be generated between the first sampling point with a depth value of 3 and the three first sampling points with a depth value of 4, respectively, and are recorded as V34_1, V34_2, and V34_3.
[0133] It should be noted that, according to the law of conservation of mass, for the first sampling point with a depth value of 3, the water flowing in and out should be balanced. Therefore, the sum of the lengths of the three first vectors V34_1, V34_2, and V34_3 should be equal to the length of the first vector V23, which is the first vector flowing from the first sampling point with a depth value of 2 into the first sampling point with a depth value of 3. Usually, the lengths of the three first vectors V34_1, V34_2, and V34_3 can all be set to one third of the length of the first vector V23.
[0134] Specifically, Fig. 9 is a schematic diagram of another optional fluid information determination process according to an embodiment of the present invention, such as Fig. 9 As shown, by analyzing the first sampling point with a depth value of 5, it can be found that there is no first sampling point with a depth value higher than 5 among the adjacent first sampling points of the first sampling point. At this time, a second vector can be generated between the first sampling point with a depth value of 5 and another adjacent first sampling point with a depth value of 5, which is recorded as V55. The length of the second vector V55 can be equal to the length of the first vector V45_1 input to the first sampling point with a depth value of 5.
[0135] Still like Figure 7 As shown, for each of the multiple first sampling points with depth values in the river area, after generating the first vector or the second vector, all possible paths of water flow in the river area can be determined, thereby better simulating the water flow situation.
[0136] It should be noted that, for a first sampling point having multiple first vectors, the multiple first vectors corresponding to the first sampling point may be summed to determine a target first vector corresponding to the first sampling point.
[0137] Optionally, in step S33, acquiring the second fluid information of the plurality of second sampling points through the first fluid information may include the following execution steps:
[0138] Step S331, searching from multiple directions for a third sampling point adjacent to each of the multiple second sampling points;
[0139] Step S332: Acquire the second fluid information using the found third sampling point.
[0140] The plurality of second sampling points may be sampling points obtained by sampling from some virtual plots belonging to the solid terrain area among the plurality of virtual plots. The plurality of third sampling points may be the remaining sampling points except the fluid source among the plurality of sampling points obtained by sampling from some virtual plots belonging to the fluid terrain area among the plurality of virtual plots.
[0141] The above-mentioned multiple directions may be eight connected directions. From the eight connected directions, a third sampling point adjacent to each of the above-mentioned multiple second sampling points may be searched, and then the second fluid information of the multiple second sampling points may be obtained by using the found third sampling point adjacent to each of the multiple second sampling points. The second fluid information may be used to determine the flow velocity and direction corresponding to each of the multiple second sampling points. The second fluid information may be used to produce a fluid effect.
[0142] Optionally, in step S332, obtaining the second fluid information by using the found third sampling point may include the following execution steps:
[0143] Step S3321, using the length of the output vector connected to the found third sampling point to obtain the length of the output vector connected to each second sampling point;
[0144] Step S3322, obtaining the direction of the output vector connected to each second sampling point by using the relative position relationship between each second sampling point and the found third sampling point;
[0145] Step S3323, determining the second fluid information based on the output vector length and the output vector direction.
[0146] The length of the output vector connected to the third sampling point is the length of the vector emitted by the third sampling point. The length of the output vector connected to the third sampling point may be the total length of at least one output vector connected to the third sampling point. The length of the output vector connected to each second sampling point can be obtained by using the length of the output vector connected to the third sampling point queried based on each second sampling point among the plurality of second sampling points.
[0147] By using the relative position relationship between each second sampling point and the found third sampling point, the direction of the output vector connected to each second sampling point can be obtained. The output vector direction can be the direction of the combined vector determined by at least one output vector connected to the second sampling point.
[0148] Based on the output vector length and output vector direction of each of the plurality of second sampling points, the second fluid information of the plurality of second sampling points can be determined and obtained. The second fluid information can be used to determine the flow velocity and direction corresponding to each of the plurality of second sampling points.
[0149] Fig.10 is a schematic diagram of another optional fluid information determination process according to an embodiment of the present invention, such as Fig.10 As shown, by analyzing the second sampling point belonging to the riverbank area, three first sampling points adjacent to the second sampling point (with depth values of 3, 4, and 5, respectively) can be determined.
[0150] Still like Fig.10 As shown, through the first vector V34_1 output by the first sampling point with a depth value of 3, the first vector V45_1 output by the first sampling point with a depth value of 4, and the second vector V55 output by the first sampling point with a depth value of 5, the output vector Va1 corresponding to the above second sampling points can be determined.
[0151] Specifically, vector V34_1, vector V45_1 and vector V55 are synthesized to obtain a resultant vector, and the direction of the resultant vector is used as the direction of vector Va1. The average of the length of vector V34_1, the length of vector V45_1 and the length of vector V55 is calculated, and the average is used as the length of vector Va1.
[0152] Still like Figure 5 As shown, for each of the multiple second sampling points in the riverbank area, the above analysis and calculation are performed to obtain the output vector (including the output vector direction and the output vector length) corresponding to each of the multiple second sampling points.
[0153] Optionally, in step S34, generating a flow map using the first fluid information and the second fluid information may include the following execution steps:
[0154] Step S341, using the first fluid information and the second fluid information to determine target fluid information of multiple sampling points corresponding to each of the multiple virtual plots included in the virtual terrain model;
[0155] Step S342: In the shader corresponding to the target fluid, the target fluid information is used to generate a flow map.
[0156] The plurality of sampling points corresponding to each virtual plot may include: a midpoint of the virtual plot and eight adjacent points connected to the midpoint of the virtual plot in an eight-connected manner. Using the first fluid information and the second fluid information, target fluid information of the plurality of sampling points corresponding to each of the plurality of virtual plots included in the virtual terrain model may be determined.
[0157] By using the shader corresponding to the target fluid, the target fluid information can be used to generate the flow map. The shader corresponding to the target fluid can be a shader in a preset game engine or a shader pre-made by a technician. The flow map can be a map for storing the flow information corresponding to the target fluid.
[0158] Fig.11 is a schematic diagram of an optional fluid information determination result according to an embodiment of the present invention, such as Fig.11 As shown in FIG. 1 , the water flow information (equivalent to the above-mentioned target fluid information) of the virtual terrain can be determined by the output vectors (including the output vector direction and the output vector length) corresponding to multiple land sampling points in the virtual terrain (including the first sampling point in the river area and the second sampling point in the riverbank area). The water flow information can be as follows: Fig.11 The output vectors corresponding to the multiple terrain sampling points shown in . According to the output vectors, a flow map for rendering a river in a virtual terrain can be generated.
[0159] It is easy to notice that, through the method provided by the embodiment of the present invention, when designing a virtual game scene, based on the virtual land information, only the source of the water flow needs to be set, and the water flow information can be determined through terrain sampling, sampling point connection, and flow vector calculation, thereby obtaining a more realistic virtual water body. Therefore, the beneficial effects of the embodiment of the present invention at least include: reducing the cost of making water bodies in virtual game scenes and improving the virtual reality effect of the made water bodies.
[0160] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0161] In this embodiment, a target fluid rendering device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0162] Fig.12 is a structural block diagram of a target fluid rendering device according to one embodiment of the present invention. Fig.12 As shown, the device includes: a first acquisition module 1201, used to acquire multiple first sampling points and multiple second sampling points on a virtual terrain model of a game scene, wherein the multiple first sampling points are located in a first terrain area, and the multiple second sampling points are located in a second terrain area, the first terrain area is a fluid terrain area, and the second terrain area is a solid terrain area; a second acquisition module 1202, used to acquire first fluid information of the multiple first sampling points based on a connectivity relationship between the multiple first sampling points, wherein the first fluid information is used to determine a flow velocity and a direction corresponding to each of the multiple first sampling points; a third acquisition module 1203, used to acquire second fluid information of the multiple second sampling points through the first fluid information, wherein the second fluid information is used to determine a flow velocity and a direction corresponding to each of the multiple second sampling points; a rendering module 1204, used to generate a flow map using the first fluid information and the second fluid information to render and display the target fluid in the first terrain area.
[0163] Optionally, the first acquisition module 1201 is further used to: sample multiple virtual plots included in the virtual terrain model to obtain multiple plot sampling points; and divide the multiple plot sampling points into multiple first sampling points and multiple second sampling points according to the type of each plot sampling point in the multiple plot sampling points.
[0164] Optionally, the multiple virtual plots include: multiple first plots and multiple second plots, the multiple first plots are located in the first terrain area, and the multiple second plots are located in the boundary area between the first terrain area and the second terrain area. The above-mentioned target fluid rendering device also includes: a determination module 1205 (not shown in the figure), which is used to obtain the belonging plot of each plot sampling point in the multiple plot sampling points and the position information of each plot sampling point in the belonging plot from the multiple first plots and the multiple second plots; determine the type of each plot sampling point based on the belonging plot and the position information.
[0165] Optionally, the above-mentioned determination module 1205 is also used to: select a target sampling point from multiple plot sampling points; in response to the plot to which the target sampling point belongs being any plot among multiple first plots, determine the target sampling point as a fluid type sampling point; in response to the plot to which the target sampling point belongs being any plot among multiple second plots and the target sampling point being determined to be located in the first terrain area based on the position information, determine the target sampling point as a fluid type sampling point; in response to the plot to which the target sampling point belongs being any plot among multiple second plots and the target sampling point being determined to be located in the second terrain area based on the position information, determine the target sampling point as a solid type sampling point.
[0166] Optionally, the second acquisition module 1202 is further used to: search for adjacent sampling points of each of the multiple first sampling points from multiple directions, and establish a connection between each first sampling point and the found adjacent sampling points to obtain a connectivity relationship; based on the connectivity relationship, select a fluid source from the multiple first sampling points; calculate a depth value of each of the multiple third sampling points relative to the fluid source, wherein the multiple third sampling points are the remaining sampling points of the multiple first sampling points except the fluid source; and obtain the first fluid information using the depth value.
[0167] Optionally, the second acquisition module 1202 is further used to: sequentially determine whether there is an adjacent sampling point with a higher depth value for each of the multiple third sampling points; in response to the existence of an adjacent sampling point with a higher depth value in multiple directions, generate a first vector between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value, wherein the first vector is used to determine the flow velocity and direction of the target fluid between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value; in response to the absence of an adjacent sampling point with a higher depth value in multiple directions, generate a second vector between two adjacent third sampling points with the same depth value, wherein the second vector is used to determine the flow velocity and direction of the target fluid between two adjacent third sampling points with the same depth value; and determine all subsequent sampling points to be passed by each of the multiple third sampling points based on the first vector and the second vector to obtain the first fluid information.
[0168] Optionally, the third acquisition module 1203 is further used to: search for a third sampling point adjacent to each of the multiple second sampling points from multiple directions; and acquire the second fluid information using the found third sampling points.
[0169] Optionally, the third acquisition module 1203 is further used to: obtain the length of the output vector connected to each second sampling point using the length of the output vector connected to the found third sampling point; obtain the direction of the output vector connected to each second sampling point using the relative position relationship between each second sampling point and the found third sampling point; and determine the second fluid information based on the output vector length and the output vector direction.
[0170] Optionally, the rendering module 1204 is further used to: use the first fluid information and the second fluid information to determine target fluid information of multiple sampling points corresponding to each of the multiple virtual plots included in the virtual terrain model; and use the target fluid information to generate a flow map in a shader corresponding to the target fluid.
[0171] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0172] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0173] Optionally, in this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0174] Optionally, in this embodiment, the computer-readable storage medium may be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the mobile terminals in a mobile terminal group.
[0175] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0176] A plurality of first sampling points and a plurality of second sampling points are obtained on a virtual terrain model of a game scene, wherein the plurality of first sampling points are located in a first terrain region, the plurality of second sampling points are located in a second terrain region, the first terrain region is a fluid terrain region, and the second terrain region is a solid terrain region; first fluid information of the plurality of first sampling points is obtained based on a connectivity relationship between the plurality of first sampling points, wherein the first fluid information is used to determine a flow velocity and a direction corresponding to each of the plurality of first sampling points; second fluid information of the plurality of second sampling points is obtained through the first fluid information, wherein the second fluid information is used to determine a flow velocity and a direction corresponding to each of the plurality of second sampling points; and a flow map is generated using the first fluid information and the second fluid information to render and display a target fluid in the first terrain region.
[0177] Optionally, obtaining multiple first sampling points and multiple second sampling points on the virtual terrain model of the game scene includes: sampling multiple virtual plots contained in the virtual terrain model to obtain multiple plot sampling points; and dividing the multiple plot sampling points into multiple first sampling points and multiple second sampling points according to the type of each plot sampling point in the multiple plot sampling points.
[0178] Optionally, the multiple virtual plots include: multiple first plots and multiple second plots, the multiple first plots are located in a first terrain area, and the multiple second plots are located in a boundary area between the first terrain area and the second terrain area. The method also includes: obtaining, from the multiple first plots and the multiple second plots, the belonging plot of each plot sampling point in the multiple plot sampling points and the position information of each plot sampling point in the belonging plot; and determining the type of each plot sampling point based on the belonging plot and the position information.
[0179] Optionally, determining the type of each plot sampling point based on the belonging plot and the position information includes: selecting a target sampling point from multiple plot sampling points; in response to the belonging plot of the target sampling point being any plot among multiple first plots, determining the target sampling point to be a fluid type sampling point; in response to the belonging plot of the target sampling point being any plot among multiple second plots and determining based on the position information that the target sampling point is located in a first terrain area, determining the target sampling point to be a fluid type sampling point; in response to the belonging plot of the target sampling point being any plot among multiple second plots and determining based on the position information that the target sampling point is located in a second terrain area, determining the target sampling point to be a solid type sampling point.
[0180] Optionally, obtaining the first fluid information of the multiple first sampling points based on the connectivity relationship between the multiple first sampling points includes: searching for adjacent sampling points of each of the multiple first sampling points from multiple directions, and establishing a connection between each first sampling point and the found adjacent sampling points to obtain a connectivity relationship; based on the connectivity relationship, selecting a fluid source from the multiple first sampling points; calculating a depth value of each third sampling point in the multiple third sampling points relative to the fluid source, wherein the multiple third sampling points are the remaining sampling points in the multiple first sampling points except the fluid source; and obtaining the first fluid information using the depth value.
[0181] Optionally, obtaining the first fluid information using the depth value includes: determining in sequence whether each of the multiple third sampling points has an adjacent sampling point with a higher depth value; in response to the existence of adjacent sampling points with higher depth values in multiple directions, generating a first vector between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value, wherein the first vector is used to determine the flow rate and direction of the target fluid between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value; in response to the absence of adjacent sampling points with a higher depth value in multiple directions, generating a second vector between two adjacent third sampling points with the same depth value, wherein the second vector is used to determine the flow rate and direction of the target fluid between the two adjacent third sampling points with the same depth value; and determining all subsequent sampling points to be passed by each of the multiple third sampling points based on the first vector and the second vector to obtain the first fluid information.
[0182] Optionally, the length of the input vector connected to each third sampling point among the plurality of third sampling points is equal to the length of the output vector connected to the third sampling point.
[0183] Optionally, acquiring the second fluid information of the plurality of second sampling points through the first fluid information includes: searching for a third sampling point adjacent to each of the plurality of second sampling points from multiple directions; and acquiring the second fluid information using the found third sampling points.
[0184] Optionally, obtaining the second fluid information using the found third sampling point includes: obtaining the length of the output vector connected to each second sampling point using the length of the output vector connected to the found third sampling point; obtaining the direction of the output vector connected to each second sampling point using the relative position relationship between each second sampling point and the found third sampling point; and determining the second fluid information based on the output vector length and the output vector direction.
[0185] Optionally, using the first fluid information and the second fluid information to generate a flow map includes: using the first fluid information and the second fluid information to determine target fluid information of multiple sampling points corresponding to each of multiple virtual plots included in the virtual terrain model; and in a shader corresponding to the target fluid, using the target fluid information to generate a flow map.
[0186] In the computer-readable storage medium of this embodiment, a technical solution of a target fluid rendering method is provided. By obtaining a plurality of first sampling points and a plurality of second sampling points on a virtual terrain model of a game scene, and obtaining first fluid information of the plurality of first sampling points based on the connectivity relationship between the plurality of first sampling points, and further obtaining second fluid information of the plurality of second sampling points through the first fluid information, the target fluid in the first terrain region is rendered and displayed by generating a flow map using the first fluid information and the second fluid information, so as to achieve the purpose of determining the corresponding fluid information through the sampling points on the fluid region and the terrain region to generate a flow map and the target fluid, thereby achieving the technical effect of improving the virtual reality effect of water body production in a virtual game scene at a relatively low cost, and further solving the technical problem of high cost and poor virtual reality effect of the method of producing water body by relying on water body without interactive information or pre-designed flow map in the related art.
[0187] Through the description of the above implementation modes, it is easy for those skilled in the art to understand that the example implementation modes described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation mode of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation mode of the present invention.
[0188] In the exemplary embodiment of the present application, a program product capable of implementing the above method of the present embodiment is stored on a computer-readable storage medium. In some possible implementations, various aspects of the embodiments of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary implementations of the present invention described in the above "Exemplary Method" section of the present embodiment.
[0189] The program product for implementing the above method according to the embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the embodiment of the present invention is not limited thereto. In the embodiment of the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0190] The program product may be in any combination of one or more computer-readable media. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive) of computer-readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0191] It should be noted that the program code contained in the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0192] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0193] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0194] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0195] A plurality of first sampling points and a plurality of second sampling points are obtained on a virtual terrain model of a game scene, wherein the plurality of first sampling points are located in a first terrain region, the plurality of second sampling points are located in a second terrain region, the first terrain region is a fluid terrain region, and the second terrain region is a solid terrain region; first fluid information of the plurality of first sampling points is obtained based on a connectivity relationship between the plurality of first sampling points, wherein the first fluid information is used to determine a flow velocity and a direction corresponding to each of the plurality of first sampling points; second fluid information of the plurality of second sampling points is obtained through the first fluid information, wherein the second fluid information is used to determine a flow velocity and a direction corresponding to each of the plurality of second sampling points; and a flow map is generated using the first fluid information and the second fluid information to render and display a target fluid in the first terrain region.
[0196] Optionally, obtaining multiple first sampling points and multiple second sampling points on the virtual terrain model of the game scene includes: sampling multiple virtual plots contained in the virtual terrain model to obtain multiple plot sampling points; and dividing the multiple plot sampling points into multiple first sampling points and multiple second sampling points according to the type of each plot sampling point in the multiple plot sampling points.
[0197] Optionally, the multiple virtual plots include: multiple first plots and multiple second plots, the multiple first plots are located in a first terrain area, and the multiple second plots are located in a boundary area between the first terrain area and the second terrain area. The method also includes: obtaining, from the multiple first plots and the multiple second plots, the belonging plot of each plot sampling point in the multiple plot sampling points and the position information of each plot sampling point in the belonging plot; and determining the type of each plot sampling point based on the belonging plot and the position information.
[0198] Optionally, determining the type of each plot sampling point based on the belonging plot and the position information includes: selecting a target sampling point from multiple plot sampling points; in response to the belonging plot of the target sampling point being any plot among multiple first plots, determining the target sampling point to be a fluid type sampling point; in response to the belonging plot of the target sampling point being any plot among multiple second plots and determining based on the position information that the target sampling point is located in a first terrain area, determining the target sampling point to be a fluid type sampling point; in response to the belonging plot of the target sampling point being any plot among multiple second plots and determining based on the position information that the target sampling point is located in a second terrain area, determining the target sampling point to be a solid type sampling point.
[0199] Optionally, obtaining the first fluid information of the multiple first sampling points based on the connectivity relationship between the multiple first sampling points includes: searching for adjacent sampling points of each of the multiple first sampling points from multiple directions, and establishing a connection between each first sampling point and the found adjacent sampling points to obtain a connectivity relationship; based on the connectivity relationship, selecting a fluid source from the multiple first sampling points; calculating a depth value of each third sampling point in the multiple third sampling points relative to the fluid source, wherein the multiple third sampling points are the remaining sampling points in the multiple first sampling points except the fluid source; and obtaining the first fluid information using the depth value.
[0200] Optionally, obtaining the first fluid information using the depth value includes: determining in sequence whether each of the multiple third sampling points has an adjacent sampling point with a higher depth value; in response to the existence of adjacent sampling points with higher depth values in multiple directions, generating a first vector between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value, wherein the first vector is used to determine the flow rate and direction of the target fluid between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value; in response to the absence of adjacent sampling points with a higher depth value in multiple directions, generating a second vector between two adjacent third sampling points with the same depth value, wherein the second vector is used to determine the flow rate and direction of the target fluid between the two adjacent third sampling points with the same depth value; and determining all subsequent sampling points to be passed by each of the multiple third sampling points based on the first vector and the second vector to obtain the first fluid information.
[0201] Optionally, the length of the input vector connected to each third sampling point among the plurality of third sampling points is equal to the length of the output vector connected to the third sampling point.
[0202] Optionally, acquiring the second fluid information of the plurality of second sampling points through the first fluid information includes: searching for a third sampling point adjacent to each of the plurality of second sampling points from multiple directions; and acquiring the second fluid information using the found third sampling points.
[0203] Optionally, obtaining the second fluid information using the found third sampling point includes: obtaining the length of the output vector connected to each second sampling point using the length of the output vector connected to the found third sampling point; obtaining the direction of the output vector connected to each second sampling point using the relative position relationship between each second sampling point and the found third sampling point; and determining the second fluid information based on the output vector length and the output vector direction.
[0204] Optionally, using the first fluid information and the second fluid information to generate a flow map includes: using the first fluid information and the second fluid information to determine target fluid information of multiple sampling points corresponding to each of multiple virtual plots included in the virtual terrain model; and in a shader corresponding to the target fluid, using the target fluid information to generate a flow map.
[0205] In the electronic device of this embodiment, a technical solution of a method for rendering a target fluid is provided. By obtaining a plurality of first sampling points and a plurality of second sampling points on a virtual terrain model of a game scene, and obtaining first fluid information of the plurality of first sampling points based on the connectivity relationship between the plurality of first sampling points, and further obtaining second fluid information of the plurality of second sampling points through the first fluid information, the target fluid in the first terrain region is rendered and displayed by generating a flow map using the first fluid information and the second fluid information, so as to achieve the purpose of determining the corresponding fluid information through the sampling points on the fluid region and the terrain region to generate a flow map and the target fluid, thereby achieving the technical effect of improving the virtual reality effect of the water body in the virtual game scene at a relatively low cost, and further solving the technical problem of the high cost and poor virtual reality effect of the method of producing water body by relying on water body without interactive information or pre-designed flow map in the related art.
[0206] Fig.13 is a schematic diagram of an electronic device according to an embodiment of the present invention. Fig.13 As shown, the electronic device 1300 is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0207] like Fig.13 As shown, the electronic device 1300 is in the form of a general computing device. The components of the electronic device 1300 may include but are not limited to: at least one processor 1310, at least one memory 1320, a bus 1330 connecting different system components (including the memory 1320 and the processor 1310), and a display 1340.
[0208] The memory 1320 stores program codes, which can be executed by the processor 1310, so that the processor 1310 executes the steps of various exemplary embodiments of the present invention described in the method part of the embodiment of the present application.
[0209] The memory 1320 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 13201 and / or a cache memory unit 13202, and may further include a read-only memory unit (ROM) 13203, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0210] In some examples, the memory 1320 may also include a program / utility 13204 having a set (at least one) of program modules 13205, such program modules 13205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may include the implementation of a network environment. The memory 1320 may further include a memory remotely disposed relative to the processor 1310, and these remote memories may be connected to the electronic device 1300 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0211] The bus 1330 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a local bus of the processor 1310, or a bus using any of a variety of bus architectures.
[0212] The display 1340 may be, for example, a touch screen type liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 1300 .
[0213] Optionally, the electronic device 1300 may also communicate with one or more external devices 1400 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device 1300, and / or any device that enables the electronic device 1300 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1350. Furthermore, the electronic device 1300 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1360. Fig.13 As shown, the network adapter 1360 communicates with other modules of the electronic device 1300 via the bus 1330. It should be understood that although Fig.13 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 1300, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0214] The electronic device 1300 may further include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply and / or a camera.
[0215] It can be understood by those skilled in the art that Fig.13The structure shown is only for illustration and does not limit the structure of the above electronic device. Fig.13 More or fewer components as shown, or with Fig.13 The memory 1320 may be used to store computer programs and corresponding data, such as the computer programs and corresponding data corresponding to the target fluid rendering method in the embodiment of the present invention. The processor 1310 executes various functional applications and data processing by running the computer programs stored in the memory 1320, that is, implementing the target fluid rendering method described above.
[0216] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0217] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0218] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0219] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0220] In addition, each functional unit in each embodiment of the present invention 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. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0221] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0222] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A target fluid rendering method, characterized in that: include: Acquire a plurality of first sampling points and a plurality of second sampling points on a virtual terrain model of a game scene, wherein the plurality of first sampling points are located in a first terrain region, the plurality of second sampling points are located in a second terrain region, the first terrain region is a fluid terrain region, and the second terrain region is a solid terrain region; Selecting a fluid source based on the connectivity relationship between the plurality of first sampling points; Calculating a depth value of each third sampling point in a plurality of third sampling points relative to the fluid source, wherein the plurality of third sampling points are the remaining sampling points in the plurality of first sampling points except the fluid source; Using the depth value, obtaining first fluid information of the plurality of first sampling points, wherein the first fluid information is used to determine a flow velocity and a direction corresponding to each of the plurality of first sampling points; Based on the length of the output vector connected to the third sampling point adjacent to each of the plurality of second sampling points and the relative position relationship between each second sampling point and the third sampling point, second fluid information of the plurality of second sampling points is acquired, wherein the second fluid information is used to determine the flow velocity and direction corresponding to each of the plurality of second sampling points; The first fluid information and the second fluid information are used to generate a flow map to render and display the target fluid in the first terrain area.
2. The target fluid rendering method according to claim 1, characterized in that: Acquiring the plurality of first sampling points and the plurality of second sampling points on the virtual terrain model of the game scene comprises: Sampling a plurality of virtual plots included in the virtual terrain model to obtain a plurality of plot sampling points; According to the type of each of the plurality of land parcel sampling points, the plurality of land parcel sampling points are divided into the plurality of first sampling points and the plurality of second sampling points.
3. The target fluid rendering method according to claim 2, characterized in that: The plurality of virtual plots include: a plurality of first plots and a plurality of second plots, the plurality of first plots are located in the first terrain area, and the plurality of second plots are located in a boundary area between the first terrain area and the second terrain area, and the method further includes: From the plurality of first plots and the plurality of second plots, obtaining the plot to which each plot sampling point in the plurality of plot sampling points belongs and the position information of each plot sampling point in the plot to which it belongs; The type of each plot sampling point is determined based on the belonging plot and the location information.
4. The target fluid rendering method according to claim 3, characterized in that: Determining the type of each plot sampling point based on the belonging plot and the location information includes: Selecting a target sampling point from the plurality of plot sampling points; In response to the land parcel to which the target sampling point belongs being any of the plurality of first land parcels, determining the target sampling point to be a fluid type sampling point; In response to the belonging plot of the target sampling point being any plot of the plurality of second plots and the target sampling point being determined to be located in the first terrain area based on the position information, determining the target sampling point to be the fluid type sampling point; In response to the belonging plot of the target sampling point being any plot of the plurality of second plots and the target sampling point being determined to be located in the second terrain area based on the position information, the target sampling point is determined to be a solid type sampling point.
5. The target fluid rendering method according to claim 1, characterized in that: Acquiring the first fluid information of the plurality of first sampling points based on the connectivity relationship between the plurality of first sampling points includes: Searching for adjacent sampling points of each of the plurality of first sampling points from multiple directions, and establishing a connection between each first sampling point and the searched adjacent sampling points to obtain the connectivity relationship; Based on the connectivity relationship, selecting a fluid source from the plurality of first sampling points; Calculating a depth value of each third sampling point in a plurality of third sampling points relative to the fluid source, wherein the plurality of third sampling points are the remaining sampling points in the plurality of first sampling points except the fluid source; The first fluid information is acquired using the depth value.
6. The target fluid rendering method according to claim 5, characterized in that: Acquiring the first fluid information by using the depth value includes: Determine in sequence whether each of the plurality of third sampling points has an adjacent sampling point with a higher depth value; In response to the presence of adjacent sampling points with higher depth values in the multiple directions, generating a first vector between a third sampling point with a lower depth value and an adjacent sampling point with a higher depth value, wherein the first vector is used to determine the flow velocity and direction of the target fluid between the third sampling point with a lower depth value and the adjacent sampling point with a higher depth value; In response to the absence of adjacent sampling points with higher depth values in the multiple directions, generating a second vector between two adjacent third sampling points with the same depth value, wherein the second vector is used to determine the flow velocity and direction of the target fluid between the two adjacent third sampling points with the same depth value; All subsequent sampling points through which each third sampling point in the plurality of third sampling points flows are determined based on the first vector and the second vector to obtain the first fluid information.
7. The target fluid rendering method according to claim 6, characterized in that: The length of the input vector connected to each third sampling point among the plurality of third sampling points is equal to the length of the output vector connected to the third sampling point.
8. The target fluid rendering method according to claim 6, characterized in that: Acquiring the second fluid information of the plurality of second sampling points through the first fluid information includes: Searching for a third sampling point adjacent to each second sampling point in the plurality of second sampling points from the plurality of directions; The second fluid information is acquired using the found third sampling point.
9. The target fluid rendering method according to claim 8, characterized in that: Acquiring the second fluid information using the found third sampling point includes: Using the length of the output vector connected to the found third sampling point, obtain the length of the output vector connected to each second sampling point; Obtaining the direction of the output vector connected to each second sampling point by using the relative position relationship between each second sampling point and the found third sampling point; The second fluid information is determined based on the output vector length and the output vector direction.
10. The target fluid rendering method according to claim 2, characterized in that: Generating the flow map using the first fluid information and the second fluid information includes: Determine target fluid information of a plurality of sampling points corresponding to each of a plurality of virtual plots included in the virtual terrain model by using the first fluid information and the second fluid information; In a shader corresponding to the target fluid, the flow map is generated using the target fluid information.
11. A target fluid rendering device, characterized in that: include: A first acquisition module is used to acquire a plurality of first sampling points and a plurality of second sampling points on a virtual terrain model of a game scene, wherein the plurality of first sampling points are located in a first terrain area, the plurality of second sampling points are located in a second terrain area, the first terrain area is a fluid terrain area, and the second terrain area is a solid terrain area; A second acquisition module is used to select a fluid source based on the connectivity relationship between the plurality of first sampling points, calculate a depth value of each third sampling point in a plurality of third sampling points relative to the fluid source, wherein the plurality of third sampling points are the remaining sampling points in the plurality of first sampling points except the fluid source, and obtain first fluid information of the plurality of first sampling points using the depth value, wherein the first fluid information is used to determine a flow velocity and a direction corresponding to each first sampling point in the plurality of first sampling points; A third acquisition module, configured to acquire second fluid information of the plurality of second sampling points based on the length of an output vector connected to the third sampling points adjacent to each of the plurality of second sampling points and a relative positional relationship between each second sampling point and the third sampling point, wherein the second fluid information is used to determine a flow velocity and a direction corresponding to each of the plurality of second sampling points; A rendering module is used to generate a flow map using the first fluid information and the second fluid information to render and display the target fluid in the first terrain area.
12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the target fluid rendering method described in any one of claims 1 to 10 when running.
13. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the target fluid rendering method described in any one of claims 1 to 10.
Citation Information
Patent Citations
Ground surface processing method and device for game scene, processor and electronic device
CN111111172A
Three-dimensional virtual cloud model processing method, storage medium, processor and electronic device
CN111145326A
Baking method and device for water system, storage medium and electronic device
CN111862291A
Image processing method and device, electronic equipment and storage medium
CN112446941A
Virtual scene rendering method and device, storage medium and electronic equipment
CN113034662A
