Method and device for rendering weather effects in a virtual scene, and weather system

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

Patent Information

Application Number
CN202311083374.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-25
Publication Date
2026-09-08
Estimated Expiration
2043-08-25

AI Technical Summary

Technical Problem

[0005]本申请提供了一种虚拟场景中天气效果的渲染方法及其装置、天气系统、电子设备以及计算机可读存储介质,以解决现有的天气系统存在的因无法与游戏数据相关联,导致不能满足策略类大世界游戏的天气效果渲染需求的技术问题

Benefits of technology

[0011] Compared with existing technologies, the weather effect rendering method in a virtual scene provided in this application includes: deploying a first number of particle emission points in the first virtual scene according to first game data corresponding to the first virtual scene, wherein the first virtual scene includes at least a portion of the virtual scene, the first game data is used to represent the preset weather state of the first virtual scene at a first rendering time, and the first rendering time is any rendering time for rendering the weather effect of the virtual scene; controlling the first number of particle emission points to emit multiple particles and obtaining first data corresponding to the multiple particles; recording the first data corresponding to the multiple particles in a first texture map corresponding to the first virtual scene; and rendering the weather effect corresponding to the first virtual scene at the first rendering time according to the first texture map corresponding to the first virtual scene. This method deploys a first number of particle emission points in the first virtual scene according to the first game data corresponding to the first virtual scene at the first rendering time. That is, different virtual scenes and different rendering times will result in different game data, and the number and position of particle emission points deployed in the virtual scene according to the game data will also be different. Furthermore, controlling different numbers and positions of particle emission points to emit particles will also result in different first data. Weather effects are rendered based on a first texture map containing first data; therefore, different first data will result in different rendered weather effects. Thus, the weather effect rendering method for virtual scenes provided in this application can render different weather effects for different areas of a virtual scene based on real-time changing game data. This satisfies the need for different areas of the same game world in strategy open-world games to render different weather effects, and for the weather effects to change in real-time with changes in game data. It solves the technical problem of existing weather systems being unable to correlate with game data, thus failing to meet the weather effect rendering requirements of strategy open-world games.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117138334B_ABST
    Figure CN117138334B_ABST
Patent Text Reader

Abstract

The application discloses a weather effect rendering method and device in a virtual scene, a weather system, an electronic device and a computer readable storage medium, and the method comprises the following steps: placing a first number of particle emission points in a first virtual scene according to first game data corresponding to the first virtual scene; controlling the first number of particle emission points to emit a plurality of particles, and acquiring first data corresponding to the plurality of particles; recording the first data corresponding to the plurality of particles in a first texture map corresponding to the first virtual scene; and rendering a weather effect corresponding to the first virtual scene at a first rendering time according to the first texture map. The method can render different weather effects in different regions in the virtual scene based on real-time changing game data, and meets the rendering needs of weather effects in a strategy type big world game.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for rendering weather effects in a virtual scene, a weather system, an electronic device, and a computer-readable storage medium. Background Technology

[0002] With the development of computer technology, game production no longer only considers the playability of the game, but also focuses on the quality of the game. Among them, the weather system plays an indispensable role in improving the quality of the game and realizing the immersive gaming experience of the player, and has become a common requirement in modern games.

[0003] Existing weather systems primarily rely on artists to create visual effects for game-related weather, making it impossible to correlate them with real-time game data. For more complex open-world strategy games, where different regions of the game world have clearly defined and constantly changing weather requirements, existing weather systems cannot meet the need to render different weather effects in different areas of the same game world, and to update weather effects in real-time as game data changes.

[0004] Therefore, the existing weather system has a technical problem that it cannot be linked to game data, thus failing to meet the weather effect rendering requirements of strategy open-world games. Summary of the Invention

[0005] This application provides a method and apparatus for rendering weather effects in a virtual scene, a weather system, an electronic device, and a computer-readable storage medium, to solve the technical problem that existing weather systems cannot meet the weather effect rendering requirements of strategy-based open-world games because they cannot be associated with game data.

[0006] In a first aspect, embodiments of this application provide a method for rendering weather effects in a virtual scene. The method includes: deploying a first number of particle emission points in the first virtual scene according to first game data corresponding to the first virtual scene, wherein the first virtual scene includes at least a portion of the virtual scene, the first game data is used to represent the weather state of the first virtual scene at a first rendering time, and the first rendering time is any rendering time for rendering the weather effects of the virtual scene; controlling the first number of particle emission points to emit multiple particles and acquiring first data corresponding to the multiple particles; recording the first data corresponding to the multiple particles in a first texture map corresponding to the first virtual scene; and rendering the weather effects of the first virtual scene at the first rendering time according to the first texture map corresponding to the first virtual scene.

[0007] Secondly, embodiments of this application provide a weather system in a game, the system comprising: a particle simulation system and a volumetric rendering system; wherein, the particle simulation system comprises: a deployment module, a control module, and a recording module; the deployment module is used to deploy a first number of particle emission points in the first virtual scene according to first game data corresponding to the first virtual scene, wherein the first virtual scene includes at least a portion of the virtual scene, the first game data is used to represent the weather state of the first virtual scene at a first rendering time, and the first rendering time is any rendering time for rendering the weather effect of the virtual scene; the control module is used to control the first number of particle emission points to emit multiple particles and acquire first data corresponding to the multiple particles; the recording module is used to record the first data corresponding to the multiple particles in a first texture map corresponding to the first virtual scene; the volumetric rendering system is used to render the weather effect of the first virtual scene at the first rendering time according to the first texture map corresponding to the first virtual scene.

[0008] Thirdly, embodiments of this application provide a rendering apparatus for weather effects in a virtual scene. The apparatus includes: a particle emission point placement unit, a particle emission control unit, a particle data recording unit, and a weather effect rendering unit. The particle emission point placement unit is used to place a first number of particle emission points in the first virtual scene according to first game data corresponding to the first virtual scene. The first virtual scene includes at least a portion of the virtual scene, and the first game data represents the weather state of the first virtual scene at a first rendering time. The first rendering time is any rendering time for rendering the weather effect of the virtual scene. The particle emission control unit is used to control the first number of particle emission points to emit multiple particles and acquire first data corresponding to the multiple particles. The particle data recording unit is used to record the first data corresponding to the multiple particles in a first texture map corresponding to the first virtual scene. The weather effect rendering unit is used to render the weather effect of the first virtual scene at the first rendering time according to the first texture map corresponding to the first virtual scene.

[0009] Fourthly, embodiments of this application provide an electronic device, including: a memory and a processor; the memory is used to store one or more computer instructions; the processor is used to execute the one or more computer instructions to implement the above-described method.

[0010] Fifthly, embodiments of this application provide a computer-readable storage medium storing one or more computer instructions that, when executed by a processor, perform the method described above.

[0011] Compared with existing technologies, the weather effect rendering method in a virtual scene provided in this application includes: deploying a first number of particle emission points in the first virtual scene according to first game data corresponding to the first virtual scene, wherein the first virtual scene includes at least a portion of the virtual scene, the first game data is used to represent the preset weather state of the first virtual scene at a first rendering time, and the first rendering time is any rendering time for rendering the weather effect of the virtual scene; controlling the first number of particle emission points to emit multiple particles and obtaining first data corresponding to the multiple particles; recording the first data corresponding to the multiple particles in a first texture map corresponding to the first virtual scene; and rendering the weather effect corresponding to the first virtual scene at the first rendering time according to the first texture map corresponding to the first virtual scene. This method deploys a first number of particle emission points in the first virtual scene according to the first game data corresponding to the first virtual scene at the first rendering time. That is, different virtual scenes and different rendering times will result in different game data, and the number and position of particle emission points deployed in the virtual scene according to the game data will also be different. Furthermore, controlling different numbers and positions of particle emission points to emit particles will also result in different first data. Weather effects are rendered based on a first texture map containing first data; therefore, different first data will result in different rendered weather effects. Thus, the weather effect rendering method for virtual scenes provided in this application can render different weather effects for different areas of a virtual scene based on real-time changing game data. This satisfies the need for different areas of the same game world in strategy open-world games to render different weather effects, and for the weather effects to change in real-time with changes in game data. It solves the technical problem of existing weather systems being unable to correlate with game data, thus failing to meet the weather effect rendering requirements of strategy open-world games. Attached Figure Description

[0012] Figure 1 This is an application system diagram of a weather effect rendering method in a virtual scene provided in an embodiment of this application;

[0013] Figure 2 This is a flowchart of a method for rendering weather effects in a virtual scene according to the first embodiment of this application;

[0014] Figure 3 This is a schematic diagram of the particle emission point provided in the first embodiment of this application;

[0015] Figure 4 This is a schematic diagram of the fourth data corresponding to the calculation grid provided in the first embodiment of this application;

[0016] Figure 5 This is a schematic diagram of the first texture map provided in the first embodiment of this application;

[0017] Figure 6 These are schematic diagrams of the first and second images provided in the first embodiment of this application;

[0018] Figure 7 This is a schematic diagram of the weather system in the game provided in the second embodiment of this application;

[0019] Figure 8 This is a schematic diagram of the structure of the rendering device for weather effects in a virtual scene provided in the third embodiment of this application;

[0020] Figure 9 This is a schematic diagram of the structure of the electronic device provided in the fourth embodiment of this application. Detailed Implementation

[0021] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.

[0022] With the development of computer technology, game development no longer only considers playability but also focuses on game quality. Among these considerations, the weather system plays an indispensable role in enhancing game quality and achieving an immersive player experience, and has become a common requirement in modern games. The weather system refers to the system that drives weather effects in a game. This system often works in conjunction with the sunlight system to display different weather changes such as sunny days, fog, rain, and storms. The core of the weather system is the rendering of fog, clouds, and rain.

[0023] Existing weather systems primarily rely on visual effects created by the game's art team, making it impossible to integrate with real-time game data. For strategy open-world games, weather not only affects battlefield conditions but also conveys clear strategic information (e.g., rain affects marching speed, and wind direction determines fire locations). Therefore, different areas of the game world often have different weather conditions, and these conditions need to change in real-time in response to changes in game data. Existing game systems, unable to integrate with game data, cannot meet the weather rendering requirements of strategy open-world games.

[0024] Currently, existing weather systems often include multiple rendering schemes. The following describes several common rendering schemes: First, the sky sphere texture gradient scheme, which can simulate simple high-altitude cloud changes and allows artists to intuitively control the effect; Second, the particle system-driven particle patch scheme, which can simulate fog and raindrop effects, but is limited by the performance overhead of the particle system and is not suitable for global use; Third, the distribution map-driven volumetric cloud scheme, which uses RenderTexture (RT) to drive cloud rendering and can cover a large area of ​​the game world, but it is difficult to control local effects; Fourth, the Volume Texture (VT)-driven volumetric cloud scheme, which uses Raymarching to obtain volumetric maps and renders each cloud independently, achieving high precision, but with high memory consumption, making it difficult to use over large areas. While the aforementioned rendering schemes can render weather in game scenes, their application in open-world strategy games presents the following problems: First, they cannot be correlated with game data, failing to render real-time weather effects that change in tandem with the evolving game data. Second, the weather system is overly complex, requiring multiple rendering schemes to work together. Third, the performance consumption is too high, making it unsuitable for open-world strategy games. In summary, existing weather systems suffer from a technical limitation: they cannot be correlated with game data, thus failing to meet the weather effect rendering requirements of open-world strategy games.

[0025] In view of this, this application provides a method for rendering weather effects in a virtual scene. This method deploys a first number of particle emission points in the first virtual scene based on the first game data corresponding to the first virtual scene at the first rendering time. That is, different virtual scenes and different rendering times result in different game data, and the number and position of particle emission points deployed in the virtual scene according to the game data will also differ. Furthermore, controlling the emission of particles from different numbers and positions of particle emission points will also result in different first data. Weather effects are rendered based on a first texture map that records the first data; therefore, different first data will result in different rendered weather effects. Thus, the weather effect rendering method provided by this application can render different weather effects for different areas in a virtual scene based on real-time changing game data. This meets the need for different areas of the same game world in strategy-based open-world games to render different weather effects, and for the weather effects to change in real-time with changes in game data. It solves the technical problem that existing weather systems cannot be correlated with game data, thus failing to meet the weather effect rendering requirements of strategy-based open-world games.

[0026] The rendering method and apparatus for weather effects in a virtual scene according to this application, as well as the weather system, electronic equipment and computer-readable storage medium, will be further described in detail below with reference to specific embodiments and accompanying drawings.

[0027] Figure 1 This is an application system diagram of a weather effect rendering method in a virtual scene provided in an embodiment of this application. For example... Figure 1 As shown in (a), the system includes a game terminal 101 and a game server 102. The game terminal 101 can be any device such as a smartphone, tablet, laptop, desktop computer, or personal digital assistant (PDA). The game server 102 can be a processing device electrically connected to the game terminal 101, or a server communicatively connected to multiple game terminals 101. The game server 102 is equipped with the weather effect rendering method for virtual scenes provided in this application. When a player plays the game through the game terminal 101, the method provided in this application is executed to render weather effects in the virtual scene and present them to the player through the game terminal 101, providing an immersive gaming experience. Figure 1 As shown in (b), the system includes a game terminal 103, which can be any device such as a smartphone, tablet, laptop, desktop computer, or personal digital assistant (PDA). The weather effect rendering method for virtual scenes provided in this application is deployed on the game terminal 103. When the game terminal 103 detects that a player is playing a game, it renders the weather effects in the virtual scene using the method provided in this application embodiment and presents them to the player through the display device of the game terminal 103. The first embodiment of this application provides a method for rendering weather effects in virtual scenes. This method is applicable to the rendering of weather effects in any game, and is particularly suitable for strategy-based open-world games.

[0028] The aforementioned open-world strategy games combine strategy with a large-scale virtual world. These games typically feature expansive maps and complex game mechanics. Players assume roles such as leaders and commanders, developing strategies, managing resources, and interacting with other player characters (NPCs) to build and develop their own nations, empires, or organizations. Open-world strategy games emphasize competition, cooperation, and conflict with other players, while also highlighting players' decision-making, planning, and management abilities. Players can achieve their goals through building facilities, developing technology, organizing armies, and expanding their territory.

[0029] Therefore, strategy open-world games can be considered one of the game genres with the largest virtual scenes and the highest game complexity. The large virtual scenes and complex game strategies inevitably lead to greater difficulty in rendering weather effects in strategy open-world games. The method provided in this embodiment realizes the rendering of weather effects in strategy open-world games. This method uses game data as the driver for weather rendering, accurately and intuitively presenting weather effects to players, supporting the rendering of different weather effects in huge virtual scenes, and improving the overall visual effect after rendering.

[0030] Figure 2 This is a flowchart of the method for rendering weather effects in a virtual scene provided in this embodiment. The following is in conjunction with... Figure 2 This embodiment provides a detailed description of the method for rendering weather effects in a virtual scene. The embodiments described below are used to explain the technical solutions of this application and are not intended to limit actual use.

[0031] like Figure 2 As shown, the rendering method for weather effects in a virtual scene provided in this embodiment includes the following steps S210 to S240.

[0032] Step S210: Based on the first game data corresponding to the first virtual scene, place a first number of particle emission points in the first virtual scene. The first virtual scene includes at least a portion of the virtual scene, and the first game data represents the weather state of the first virtual scene at a first rendering time. The first rendering time is any rendering time used to render the weather effects of the virtual scene.

[0033] The virtual scene refers to a virtual environment created through computer technology, which can simulate various situations and scenarios in the real world. It can be a completely fictional environment or a simulation or reenactment of real-world conditions. Through virtual scenes, users can interact in real time with computer-generated virtual characters and environments. Virtual scenes can be applied to multiple fields and industries. In the gaming field, realistic virtual scenes provide players with an immersive gaming experience. In this embodiment, the virtual scene can be understood as the entire game space corresponding to the game map of a strategy-based open-world game.

[0034] The first virtual scene can be the entire virtual scene or a portion of it. Typically, for strategy-based open-world games, the weather in some areas of the virtual scene changes infrequently (e.g., desert areas are mostly sunny), while the weather in other areas changes frequently (e.g., tropical rainforest areas experience significant weather changes). To reduce the performance overhead of weather rendering, the entire virtual scene can be divided into multiple regions based on the frequency of weather changes. When a region with frequent weather changes is about to experience a change, only that region's weather effect needs to be re-rendered at that moment; other regions without weather changes do not need to be re-rendered. This distributed weather rendering method significantly reduces the performance overhead caused by weather rendering during game operation.

[0035] The game data can be low-level game data, i.e., low-level data written according to the game design, which the game server or game terminal uses to render the original game scene; or it can be generated game data, i.e., new data generated after the player performs actions during the game. Both low-level and new data are game data that changes in real time along with the game progress. In this embodiment, the game data is weather-related data, which reflects the weather conditions, and the corresponding game data can be obtained from the weather conditions.

[0036] The first game data refers to the game data corresponding to the first virtual scene at the first rendering time. Since the game data changes in real time along with the game process, the game data corresponding to the same virtual scene at different rendering times are different.

[0037] Upon receiving a weather effect rendering request, the game server or game terminal will deploy a first number of particle emission points in the first virtual scene based on the first game data. The weather effect rendering request may be generated by the game terminal detecting the player's login operation or the player's operation of controlling the controlled virtual character to move to the first virtual scene, etc., to request the rendering of weather effects in the first virtual scene.

[0038] In one optional implementation provided in this embodiment, the placement of particle emission points in the first virtual scene is based on the particle simulation system corresponding to the first virtual scene. In this embodiment, the particle simulation system corresponding to the first virtual scene is defined as the first particle simulation system.

[0039] The particle simulation system is a commonly used technique in computer graphics to render large numbers of particles to simulate natural phenomena or special effects. These particles can represent matter, liquids, gases, flames, smoke, explosions, etc. Particle simulation systems are typically based on the physical properties and behavioral rules of particles (e.g., particle mass, velocity, acceleration, collision, gravity, friction, and external force fields and constraints) to calculate their motion, forces, and interactions, achieving realistic physical effects. In a particle simulation system, particles can be considered as points without actual volume, whose position, velocity, and other physical properties change over time. By periodically updating and rendering these particles, various complex natural phenomena can be simulated, such as fluid flow, flame spread, and smoke diffusion. In the method provided in this embodiment, only the particle emission function of the particle simulation system is utilized; particle patch creation and rendering are not performed, significantly reducing the performance consumption of the particle simulation system during particle rendering.

[0040] The first particle simulation system refers to the particle simulation system corresponding to the first virtual scene. By configuring independent particle simulation systems for different areas in the virtual scene, distributed rendering of weather effects can be achieved.

[0041] The particle emission point refers to the starting point for emitting particles placed in the virtual scene by the particle simulation system. The particle simulation system can control the particle emission point to emit a preset number of particles according to preset particle emission parameters.

[0042] Therefore, in one optional implementation provided in this embodiment, before using the first particle simulation system, it is necessary to create a first particle simulation system corresponding to the first virtual scene in the world coordinate system. Since the first virtual scene is located in the world coordinate system, the creation of the first particle simulation system corresponding to the first virtual scene also needs to be located in the world coordinate system. In response to a request to render weather effects for the first virtual scene, the game server or game terminal will, based on the first particle simulation system and according to the first game data corresponding to the first virtual scene, place a first number of particle emission points in the first virtual scene.

[0043] In one optional implementation of this embodiment, the first game data is recorded in a fourth texture map corresponding to the first virtual scene. The fourth texture map refers to a render texture (RT) map that records the first game data. A render texture is a special type of texture that can store the rendering results of a scene, camera, or specific object in the form of a texture, and can be used in subsequent rendering processes or applied as a texture map to other objects. The fourth texture map can also be understood as a texture map covering the first virtual scene, where each pixel stores the first game data at the corresponding position in the first game scene.

[0044] In one specific implementation, deploying a first number of particle emission points in the first virtual scene may include the following steps S211 to S212:

[0045] Step S211: Read the fourth texture map, and according to the coordinates of the fourth texture map in the world coordinate system and the preset first granularity value, evenly distribute the fourth number of particle emission points in the first virtual scene.

[0046] The fourth texture map is the texture map corresponding to the first virtual scene, but the coordinates of the fourth texture map are in the range of 0-1. Therefore, in order to place particle emission points in the first virtual scene, the game server or game terminal first needs to read the fourth texture map and map the coordinates of the fourth texture map to the world coordinate system. Then, according to the coordinates of the fourth texture map in the world coordinate system, the particle emission points are placed in the first virtual scene.

[0047] The first granularity value can be understood as the density of particle emission points uniformly distributed in the first virtual scene. The larger the first granularity value, the larger the range corresponding to a particle emission point in the first virtual scene, and the fewer the total number of particle emission points. The smaller the first granularity value, the smaller the range corresponding to a particle emission point in the first virtual scene, and the more the total number of particle emission points.

[0048] When placing particle emission points, the game server or game terminal also considers a preset first granularity value and distributes the particle emission points evenly according to the first granularity value. In this embodiment, the number of particle emission points that are evenly distributed is defined as the fourth quantity.

[0049] Step S212: Based on the first game data in the fourth texture map corresponding to each particle emission point and the preset game data threshold, remove particle emission points whose first game data is less than the game data threshold from the fourth number of particle emission points to form the first number of particle emission points.

[0050] After evenly distributing a fourth number of particle emission points in the first virtual scene, the game server or game terminal will remove some particle emission points based on the first game data. In one optional implementation provided in this embodiment, the removed particle emission points are those among the fourth number of particle emission points whose first game data is less than a game data threshold.

[0051] The game data threshold can be understood as a pre-set standard value for game data to control different weather effects. Taking rainfall data as an example, the fourth texture map uses a black and white channel value to represent rainfall data, where 0 represents no rain, 1 represents heavy rain, and values ​​between 0 and 1 represent different levels of rainfall. If the game data threshold for rainfall data is set to 0.5, then the standard value for rainfall data is 0.5. When a rainfall data value is less than 0.5, the particle emission point corresponding to that rainfall data is discarded.

[0052] This method eliminates unnecessary particle emission points from the fourth number of particle emission points, reducing it to the first number. These first number of emission points are associated with the first set of game data. Different game data will then result in different particle emission point deployments, including the number and location of each point. Subsequent steps will then render different weather effects. Furthermore, by eliminating unnecessary emission points, the first particle simulation system no longer needs to globally emit particles or spend time reading particle data from these emission points, significantly reducing runtime overhead.

[0053] Figure 3 This is a schematic diagram of the particle emission points provided in this embodiment. The particle emission points are placed in the virtual scene and will not be displayed. Figure 3 The particle emission points shown are for easy understanding of the results of the debugging preview.

[0054] like Figure 3 As shown in (a), the game server or game terminal, based on the particle simulation system, reads the fourth texture map corresponding to the first virtual scene, and according to the coordinates of the fourth texture map in the world coordinate system and the preset first granularity value, evenly distributes a fourth number of particle emission points in the first virtual scene. Assuming 25 particle emission points are evenly distributed, it forms a pattern as shown in (a). Figure 3 (a) shows a first virtual scene with 25 particle emission points. Of course, in practical applications, due to the larger area of ​​the virtual scene, the number of particle emission points would also be quite large; this explanation only uses a small number of particle emission points as an example. Figure 3As shown in (b), the game server or game terminal further removes 10 particle emission points whose first game data is less than the game data threshold from the 25 particle emission points based on the first game data corresponding to each of the 25 particle emission points and a preset game data threshold, retaining 15 particle emission points whose first game data is greater than or equal to the game data threshold, forming the following... Figure 3 (b) shows the first virtual scene with 15 particle emission points.

[0055] Step S220: Control the first number of particle emission points to emit multiple particles and acquire the first data corresponding to the multiple particles.

[0056] By evenly distributing particle emission points and removing unnecessary particle emission points, a first number of particle emission points are actually distributed in the first virtual scene. The game server or game terminal can further control the first number of particle emission points to emit multiple particles based on the first particle simulation system, and the number of particles emitted is also controllable.

[0057] In one optional implementation provided in this embodiment, the number and state of particle emission from particle emission points are controlled by a mechanical model. Based on this, before controlling a first number of particle emission points to emit multiple particles, a mechanical model needs to be created according to the weather conditions of the first virtual scene at the first rendering time. The mechanical model is used to indicate the emission state of the particle emission points. The mechanical model is created in the particle editor built into the game engine. The particle editor provides basic mechanical models representing various natural phenomena, such as basic mechanical models representing cloud and fog diffusion under wind disturbance, and basic mechanical models representing the influence of terrain on airflow. Based on the basic mechanical models, further processing can be performed according to the weather conditions to be rendered, forming a mechanical model that conforms to the weather conditions.

[0058] Based on this, in a specific implementation, controlling a first number of particle emission points to emit multiple particles and obtaining the first data corresponding to the multiple particles may include the following steps S221 to S222:

[0059] Step S221: According to the mechanical model, control a first number of particle emission points to emit multiple particles with a first state parameter;

[0060] Step S222: Use the first state parameters of multiple particles as the first data corresponding to the multiple particles.

[0061] The first state parameters can be understood as the relevant parameters of each particle emitted through the particle emission point, such as the particle emission direction parameter, the particle emission velocity parameter, and the particle transparency parameter. In this embodiment, these state parameters are defined as the first data corresponding to the particle.

[0062] In this step, a pre-created mechanical model is introduced to control the particle emission point to emit particles with first state parameters. This reduces the dependence of the weather rendering method provided in this embodiment on the accuracy of game data. In other words, even if the granularity of the game data is high, this method can simulate weather effects with higher accuracy.

[0063] Step S230: Record the first data corresponding to the multiple particles in the first texture map corresponding to the first virtual scene.

[0064] The first texture map is also the texture map corresponding to the first virtual scene, which refers to the render texture (RT) map that records the first data. By recording the first data in the first texture map, the weather effect can be rendered in subsequent steps using the first texture map.

[0065] Since the first texture map is the RT map corresponding to the first virtual scene, and the first data is the particle data corresponding to multiple particles emitted by a first number of particle emission points placed in the first virtual scene, to record the particle data corresponding to multiple particles in the first texture map, it is necessary to establish a correspondence between multiple particles and each pixel of the first texture map. In an optional implementation provided in this embodiment, in order to achieve the correspondence between particles and pixels, before the step of recording the first data corresponding to multiple particles in the first texture map corresponding to the first virtual scene, it is necessary to divide the first virtual scene into a grid according to a preset second granularity value. The grid includes multiple cells of the same size. The grid can be a three-dimensional grid or a two-dimensional grid. In the method provided in this embodiment, the first virtual scene is divided into an N×M×1 two-dimensional grid, where N represents the number of cells on the horizontal axis (X-axis) of the world coordinate system, and M represents the number of cells on the vertical axis (Y-axis) of the world coordinate system. Dividing the first virtual scene into a two-dimensional grid can reduce the data dimensionality, so that no matter how many particles are emitted from the particle emission point to participate in the weather effect simulation, the final data volume is controlled within the precision of the two-dimensional grid, reducing the performance consumption in the weather effect rendering process.

[0066] The second granularity value can be understood as the density of the grid in which the first virtual scene is divided. The larger the second granularity value, the larger the area occupied by a cell in the first virtual scene and the fewer the total number of cells. The smaller the second granularity value, the smaller the area occupied by a cell in the first virtual scene and the more the total number of cells.

[0067] When the game server or game terminal divides the first virtual scene into a grid, it will consider a preset second granularity value and uniformly divide the first particle simulation system according to the second granularity value.

[0068] Based on this, in a specific implementation, recording the first data corresponding to multiple particles in the first texture map corresponding to the first virtual scene may include the following steps S231 to S232:

[0069] Step S231: Calculate the fourth data corresponding to each cell based on the number of particles in each cell and the first data corresponding to the particles.

[0070] Because the particle emission points are not uniformly distributed in the first virtual scene, and each emission point emits a certain number of particles according to a preset mechanical model, the number of particles covered by each grid cell may be different, and the corresponding first data will also be different. In the method provided in this embodiment, the fourth data corresponding to each cell is calculated based on the number of particles covered by each cell and the first data corresponding to the particles.

[0071] In one specific implementation, the first data includes at least one of the following: first particle velocity, first particle direction, and first particle transparency; the fourth data includes at least one of the following: particle density, second particle velocity, second particle direction, and second particle transparency. The particle density determines the cloud thickness, the particle velocity and direction determine the cloud flow direction, and the particle transparency determines the raindrop effect.

[0072] For each type of data, this embodiment provides the following calculation method:

[0073] Regarding particle density, the game server or game terminal calculates the particle density for each grid cell based on the number of particles contained in each cell. Specifically, the number of particles in each cell is compared with a preset particle count threshold to obtain the particle density for that cell.

[0074] The particle number threshold is an adjustable value, a preset standard value for determining particle density. Since particles themselves are points without actual volume, there is no single particle density. In this embodiment, particle density is determined by comparing the number of particles in a grid cell with the preset particle number threshold. When the number of particles in a grid cell is greater than the threshold, it indicates a high particle density; when the number of particles in a grid cell is less than the threshold, it indicates a low particle density. For example, if the particle number threshold is set to 10, and grid A covers 10 particles, the particle density of grid A can be recorded as 0.5; if grid B covers 11 particles, the particle density of grid B can be recorded as 0.6; and if grid C covers 9 particles, the particle density of grid C can be recorded as 0.4.

[0075] Regarding particle velocity, the game server or game terminal calculates the second particle velocity for each cell based on the number of particles in each cell and the first particle velocity of each particle. Specifically, the second particle velocity for each cell is obtained by averaging the first particle velocities of all particles in the cell.

[0076] Regarding particle orientation, the game server or game terminal calculates the second particle orientation for each cell based on the number of particles in each cell and the first particle orientation of each particle. Specifically, this is done by averaging the first particle orientations of all particles in the cell to obtain the second particle orientation.

[0077] Regarding particle transparency, the game server or game terminal calculates the second particle transparency for each cell based on the number of particles in each cell and the first particle transparency of those particles. Specifically, the second particle transparency of each cell is obtained by averaging the first particle transparency of all particles in the cell.

[0078] Figure 4 This is a schematic diagram of the fourth data corresponding to the calculation grid provided in this embodiment. Figure 3 (b) shows the fourth data calculation based on the first virtual scene, which includes 15 particle emission points. The first virtual scene is divided into grids, which are not displayed. Figure 4 The grid shown is for easy understanding of the results of debugging and previewing.

[0079] like Figure 4As shown in (a), the game server or game terminal places 15 particle emission points (gray points) in the first virtual scene. Based on the mechanics model, these 15 emission points are controlled to emit multiple particles (black points). The game server or game terminal divides the first virtual scene into a two-dimensional grid 41 according to a preset second granularity value. Assume that the two-dimensional grid 41 includes 36 cells of the same size, each cell covering multiple particles, with varying particle counts. Taking cell 411 in the two-dimensional grid 41 as an example, the fourth data corresponding to cell 411 is calculated. Assume that cell 411 contains 9 particles, such as... Figure 4 As shown in (b), grid 411 includes particles 421, 422, 423, 424, 425, 426, 427, 428, and 429. The first data corresponding to these 9 particles is shown in Table 1. Assuming the preset particle number threshold is 10, the fourth data corresponding to grid 411 can be calculated using the first data corresponding to the 9 particles. The specific calculation method and results are shown in Table 2.

[0080] Table 1 First Data Table

[0081]

[0082] Table 2, Fourth Data Table

[0083]

[0084]

[0085] Step S232: Based on the coordinates of the first texture map in the world coordinate system, record the fourth data corresponding to each cell in the pixel of the first texture map.

[0086] The first texture map is the texture map corresponding to the first virtual scene, but the coordinates of the first texture map are in the range of 0-1. The grid is the result of dividing the first virtual scene. Therefore, in order to record the fourth data corresponding to each cell in the grid into the first texture map, it is necessary to first map the coordinates of the first texture map to the world coordinate system, and then record the fourth data in the pixel of the first texture map according to the coordinates of the first texture map in the world coordinate system.

[0087] Since the resolution of the second granularity value corresponding to the grid may not be the same as that of the first texture map, there may be a situation where multiple grid cells correspond to a single pixel in the first texture map, or a situation where a single grid cell corresponds to multiple pixels in the first texture map. In either case, simply recording the fourth data corresponding to each grid cell in the corresponding pixel will cause the data in the first texture map to be unsmooth, resulting in abnormally hard edges in the weather effect rendered based on the first texture map.

[0088] Based on this, in an optional implementation provided in this embodiment, a preferred method for recording the fourth data corresponding to each cell in the pixel of the first texture map according to the coordinates of the first texture map in the world coordinate system can be: using Gaussian blur to calculate the pixel value of each pixel in the first texture map. Specifically, the pixel value of each pixel in the first texture map is obtained by calculating the fourth data of the eight adjacent cells corresponding to that pixel. Based on the fourth data corresponding to the eight adjacent cells, the pixel value corresponding to that pixel is calculated with a certain weight. Among them, Gaussian blur is a commonly used image processing method used for smoothing and reducing noise; its specific operation method will not be described in detail here.

[0089] Figure 5 This is a schematic diagram of the first texture map provided in this embodiment. In practical applications, this map will not be displayed. Figure 5 The first texture map shown is for easy understanding of the results of the debugging preview.

[0090] like Figure 5 As shown, different fourth data are stored in the first texture map using channels of different colors. For example, the red channel stores the velocity of the second particle, the green channel stores the direction of the second particle, the blue channel stores the particle density, and the alpha channel stores the transparency of the second particle.

[0091] Step S240: Render the weather effect corresponding to the first virtual scene at the first rendering time based on the first texture map corresponding to the first virtual scene.

[0092] In one optional implementation provided in this embodiment, rendering the weather effect corresponding to the first virtual scene at the first rendering time based on the first texture map corresponding to the first virtual scene is implemented by the game server or game terminal based on a volumetric rendering system.

[0093] The volumetric rendering system described is a technique for visualizing and rendering 3D volumetric data, capable of displaying complex internal structures and density distributions. Its basic principle is based on light propagation and integration; by performing light propagation and color integration on each volume element (e.g., voxels, sampling points) in the volumetric data, an image is ultimately generated. Compared to traditional surface rendering methods, the volumetric rendering system focuses more on the internal properties and density distribution of the volumetric data, making it more suitable for processing volumetric objects with internal structures and density distributions, such as meteorological data and medical imaging data.

[0094] Since the first texture map already stores the fourth data related to particles, and the first texture map is a rendering texture map that can be used during the rendering process, the volume rendering system can render the weather effect of the first virtual scene at the first rendering moment by sampling the first texture map.

[0095] In one optional implementation provided in this embodiment, rendering the weather effect corresponding to the first virtual scene at the first rendering time based on the volumetric rendering system may include the following steps S241 to S242:

[0096] Step S241: Sample the first texture map and the preset first image, and render the basic weather effect corresponding to the first virtual scene. The first image is used to indicate the height distribution of at least one weather element included in the weather effect in the first virtual scene.

[0097] In one specific implementation, the above steps are achieved using raymarching. Raymarching is a commonly used algorithm in volumetric rendering. When rendering volumes without clear boundaries, such as clouds, raymarching is based on the idea of ​​iterative approximation. It emits rays towards the camera and steps along the ray direction to accumulate and calculate the thickness of the cloud corresponding to each pixel.

[0098] The first image is a two-dimensional texture map indicating the vertical height distribution of weather elements in the weather effect, which can be understood as a cloud height map. The grayscale value of each pixel in the image corresponds to the cloud height at the corresponding location. Weather effects in games are often not a single weather element. In the method provided in this embodiment, each preset weather element in the weather effect can be customized in the first image. For example, by customizing the weather elements "ground fog", "weather clouds", and "rain" according to their vertical height distribution in a cloud height map, it is possible to use a single volumetric rendering system to complete weather effects including ground fog, weather clouds in the sky, and rain between the ground and the clouds.

[0099] Specifically, light rays are emitted from the observation location (e.g., the camera) to the pixels on the screen, and raymarching is performed along the direction of the light rays. The current height of the light rays is determined by the distribution height of the weather elements in the first image. During each step, the first texture map is sampled to obtain the fourth data at the current position, including particle density, second particle velocity, second particle direction, second particle transparency, etc. Based on the sampled fourth data, the basic weather effect can be rendered.

[0100] Step S242: Sample the preset second image, render the detailed effects on the basic weather effect to form the weather effect corresponding to the first virtual scene. The second image is used to indicate the detailed rendering effect of at least one weather element.

[0101] The second image is a 3D texture map indicating the detailed rendering effect of weather elements in the weather effect. It can be understood as a distorted 3D volumetric noise map. The distorted 3D volumetric noise map is an organic and intricate volumetric texture created by distorting and deforming noise maps in 3D space. It can render and simulate irregular and organic shapes and structures in nature, such as cloud layers, smoke, and flames. It can bring delicate and rich details to these effects and provide a more realistic appearance and dynamic feel. In this embodiment, after forming a basic weather effect by sampling the first texture map and the first image, further sampling the second image can add detailed effects to the basic weather effect, forming a final weather effect that is more natural and closer to reality.

[0102] Figure 6 These are schematic diagrams of the first and second images provided in this embodiment. Both the first and second images were obtained through a preset method.

[0103] like Figure 6 As shown in (a), the first image 61 is a cloud height map, including three cloud layers: cloud layer 611, cloud layer 612, and cloud layer 613, which respectively indicate the changes in the thickness of the weather elements "weather cloud," "rainfall," and "ground fog," as well as their vertical morphological changes. Figure 6 As shown in (b), the second image 62 is a 3D volumetric noise map, which includes a 3D volumetric noise map 621 corresponding to the weather element "weather cloud", a 3D volumetric noise map 622 corresponding to the weather element "rainfall", and a 3D volumetric noise map 623 corresponding to the weather element "ground fog", which are used to add an outer layer effect to the weather elements "weather cloud", "rainfall", and "ground fog".

[0104] In one specific implementation, the game server or game terminal uses a volumetric rendering system and a ray stepping method to sample data. Figure 5 The first texture map shown is as follows: Figure 6 (a) shows the cloud height diagram, as shown below. Figure 6 (b) shows a 3D volumetric noise map, which can render weather effects that are close to reality.

[0105] This step, by pre-setting a first image (cloud height map) and a second image (3D volumetric noise map), can independently control the details and dynamics of each weather element in the weather effect, reducing the dependence of the weather rendering method provided in this embodiment on the accuracy of game data.

[0106] To further optimize the realism of the weather effects, when the weather effect to be rendered includes the weather element "ground fog", the "ground fog" can be moved to the height indicated by the terrain height map corresponding to the first virtual scene, based on the weather effect.

[0107] The terrain elevation map is used to illustrate the elevation of various locations in the first virtual scene, especially the elevation of the mountains. By pushing the rendered "ground fog" to the elevation of the mountains, a realistic effect of fog swirling along the mountain ridges can be created.

[0108] When the weather effect to be rendered includes the weather element "rain", a third image can be obtained based on the first data recorded in the first texture map. The third image is used to indicate the flow direction of the rain. Based on the third image, rain along the flow direction is formed on the basis of the weather effect.

[0109] Specifically, based on the second particle velocity and direction recorded at each pixel in the first texture map, a corresponding noise wave is generated for each pixel, producing a third image indicating the flow direction. Combining this third image makes the raindrop effect more realistic and achieves the effect of a continuous downpour.

[0110] Steps S210 to S240 above provide an optional method for rendering weather effects in a virtual scene. This method is particularly suitable for mid-to-far-field rendering of weather effects in strategy-based open-world games, and greatly reduces the performance consumption of weather effect rendering.

[0111] For strategy-based open-world games, the game often involves camera movement through clouds and rainfall, meaning there are close-up weather effects in front of the camera lens. When rendering these close-up weather effects using the above method, to achieve a more realistic effect, more particle emission points need to be placed in step S210. This undoubtedly increases the overhead of the particle simulation system and the volume rendering system. Therefore, in an optional implementation provided in this embodiment, the weather rendering method further includes the following steps S11 to S12:

[0112] Step S11: In response to the camera switching to the first weather element included in the weather effect, create a particle patch corresponding to the first area in the first weather element, where the first weather element is any weather element in the weather effect, and the first area is the area in the first weather element that is currently in front of the camera.

[0113] Step S12: Based on the particle patch, render the first area of ​​the first weather element.

[0114] When the camera lens switches to the first weather element, it means that a certain area within the first weather element is currently in front of the camera lens. In this embodiment, the area in front of the camera lens within the first weather element is defined as the first area. The game server or game terminal determines the first weather element that the camera is currently passing through, and the first area in front of the camera lens, by reading the first texture map.

[0115] Specifically, for the first region, particle emission points are placed near the camera lens based on the first particle simulation system, and a certain number of particles are emitted from these emission points to form a particle patch corresponding to the first region. The weather effect in the first region in front of the camera lens is then rendered based on the particle patch. Although this step involves particle emission and particle patch creation, it only requires emitting particles near the lens, so the performance consumption is relatively low.

[0116] As described above, the weather effect rendering method provided in this embodiment can achieve distributed weather effect rendering, that is, the weather effects of different areas in the virtual scene are rendered independently. In the above steps, the weather effects of the first virtual scene were rendered. The method provided in this embodiment also includes rendering the weather effects of other virtual scene areas besides the first virtual scene, specifically including the following steps S21 to S24:

[0117] Step S21: Based on the second game data corresponding to the second virtual scene, place a second number of particle emission points in the second virtual scene. The second virtual scene includes at least a portion of the virtual scene other than the first virtual scene. The second game data is used to represent the weather state of the second virtual scene at the first rendering time.

[0118] Step S22: Control the second number of particle emission points to emit multiple particles and acquire the second data corresponding to the multiple particles.

[0119] Step S23: Record the second data corresponding to multiple particles in the second texture map corresponding to the second virtual scene.

[0120] Step S24: Render the weather effect corresponding to the second virtual scene at the first rendering time based on the second texture map corresponding to the second virtual scene.

[0121] In one optional implementation, a corresponding second particle simulation system can be created for the second virtual scene, so that different weather effects can be rendered for the first and second virtual scenes at the same rendering time. Therefore, the weather effect rendering method provided in this embodiment can realize distributed weather effect rendering.

[0122] As described above, the weather effect rendering method provided in this embodiment can also render real-time changing weather effects based on real-time game data. That is, the weather effect of the same area in the virtual scene is rendered according to different game data at different rendering times. In the above steps, the weather effect corresponding to the first virtual scene at the first rendering time was rendered. The method provided in this embodiment also includes rendering the weather effect corresponding to the first virtual scene at rendering times after the first rendering time, which may specifically include the following steps S31 to S34:

[0123] Step S31: Based on the third game data corresponding to the first virtual scene, place a third number of particle emission points in the first virtual scene. The third game data is used to represent the weather state of the first virtual scene at the second rendering time. The second rendering time is any rendering time after the first rendering time.

[0124] Step S32: Control the third number of particle emission points to emit multiple particles and obtain the third data corresponding to the multiple particles.

[0125] Step S33: Record the third data corresponding to multiple particles in the third texture map corresponding to the first virtual scene.

[0126] Step S34: Render the weather effect corresponding to the first virtual scene at the second rendering time based on the third texture map corresponding to the first virtual scene.

[0127] In an optional implementation, the weather effect rendering of the first virtual scene at the second rendering time is still based on the first particle simulation system and the volumetric rendering system. The first particle simulation system deploys different numbers and positions of particle emission points in the virtual scene according to different game data at different rendering times. Furthermore, it controls the emission of particles from these different numbers and positions to obtain different particle data. The volumetric rendering system renders different weather effects based on texture maps recording the different particle data. Therefore, the weather effect rendering method provided in this embodiment can achieve real-time weather effect rendering based on real-time game data.

[0128] The first embodiment described above provides an optional method for rendering weather effects in a virtual scene. This method renders different weather effects for different areas of the virtual scene based on real-time changing game data. In other words, this weather effect rendering method is a distributed real-time rendering method, meeting the need for different areas of the same game world in strategy-based open-world games to render different weather effects, and for the weather effects to change in real-time as the game data changes. Furthermore, this method is not limited by the precision of the game data, and can independently control the details and dynamics of weather elements in the weather effect in subsequent steps. All weather elements in the weather effect can be rendered in a single rendering pipeline, with controllable performance consumption.

[0129] It should be noted that the examples in the first embodiment are only for explaining the methods described in this application and are not intended to limit actual use. The rendering method for weather effects in virtual scenes provided in this application includes, but is not limited to, the method described in the first embodiment.

[0130] The second embodiment of this application provides a weather system for a game. Figure 7 This is a schematic diagram of the weather system in the game provided in this embodiment.

[0131] like Figure 7 As shown, the weather system in the game provided in this embodiment includes: a particle simulation system 71 and a volumetric rendering system 72; wherein,

[0132] The particle simulation system 71 includes: a deployment module 711, a control module 712, and a recording module 713;

[0133] The deployment module 711 is used to deploy a first number of particle emission points in the first virtual scene according to the first game data corresponding to the first virtual scene. The first virtual scene includes at least a part of the virtual scene. The first game data is used to represent the weather state of the first virtual scene at a first rendering time. The first rendering time is any rendering time for rendering the weather effect of the virtual scene.

[0134] The control module 712 is used to control the first number of particle emission points to emit multiple particles and to acquire first data corresponding to the multiple particles.

[0135] The recording module 713 is used to record the first data corresponding to the plurality of particles in the first texture map corresponding to the first virtual scene;

[0136] The volume rendering system 72 is used to render the weather effect corresponding to the first virtual scene at the first rendering time based on the first texture map corresponding to the first virtual scene.

[0137] The third embodiment of this application provides a rendering device for weather effects in a virtual scene. Figure 8 This is a schematic diagram of the structure of the rendering device for weather effects in a virtual scene provided in this embodiment.

[0138] like Figure 8 As shown, the weather effect rendering device in the virtual scene provided in this embodiment includes: a particle emission point placement unit 801, a particle emission control unit 802, a particle data recording unit 803, and a weather effect rendering unit 804.

[0139] The particle emission point placement unit 801 is used to place a first number of particle emission points in the first virtual scene according to the first game data corresponding to the first virtual scene. The first virtual scene includes at least a part of the virtual scene, and the first game data is used to represent the weather state of the first virtual scene at a first rendering time. The first rendering time is any rendering time for rendering the weather effect of the virtual scene.

[0140] Optionally, before the step of placing a first number of particle emission points in the first virtual scene according to the first game data corresponding to the first virtual scene, the method is further used to:

[0141] In the world coordinate system, create the first particle simulation system corresponding to the first virtual scene;

[0142] The step of deploying a first number of particle emission points in the first virtual scene based on the first game data corresponding to the first virtual scene includes:

[0143] Based on the first particle simulation system, and according to the first game data corresponding to the first virtual scene, a first number of particle emission points are deployed in the first virtual scene.

[0144] Optionally, the first game data is recorded in the fourth texture map corresponding to the first virtual scene; the step of placing a first number of particle emission points in the first virtual scene according to the first game data corresponding to the first virtual scene includes:

[0145] Read the fourth texture map, and based on the coordinates of the fourth texture map in the world coordinate system and the preset first granularity value, evenly distribute the fourth number of particle emission points in the first virtual scene;

[0146] Based on the first game data in the fourth texture map corresponding to each particle emission point and a preset game data threshold, particle emission points whose first game data is less than the game data threshold are removed from the fourth number of particle emission points to form the first number of particle emission points.

[0147] The particle emission control unit 802 is used to control the first number of particle emission points to emit multiple particles and to acquire first data corresponding to the multiple particles.

[0148] Optionally, prior to the step of controlling the first number of particle emission points to emit multiple particles, the method is further configured to:

[0149] Based on the weather conditions of the first virtual scene at the first rendering time, a mechanical model is created, which is used to indicate the emission state of the particles at the particle emission point.

[0150] Optionally, controlling the first number of particle emission points to emit multiple particles and acquiring first data corresponding to the multiple particles includes:

[0151] According to the mechanical model, the first number of particle emission points are controlled to emit the plurality of particles having a first state parameter;

[0152] The first state parameters of the plurality of particles are used as the first data corresponding to the plurality of particles.

[0153] The particle data recording unit 803 is used to record the first data corresponding to the plurality of particles in the first texture map corresponding to the first virtual scene.

[0154] Optionally, before the step of recording the first data corresponding to the plurality of particles in the first texture map corresponding to the first virtual scene, the method is further used to:

[0155] The first virtual scene is divided into a grid according to a preset second granularity value, and the grid includes multiple cells of the same size.

[0156] Optionally, recording the first data corresponding to the plurality of particles in the first texture map corresponding to the first virtual scene includes:

[0157] Calculate the fourth data corresponding to each grid cell based on the number of particles included in each grid cell and the first data corresponding to the particles.

[0158] Based on the coordinates of the first texture map in the world coordinate system, the fourth data corresponding to each of the grid cells is recorded in the pixel of the first texture map.

[0159] Optionally, the first data includes at least one of the following: first particle velocity, first particle direction, and first particle transparency; the fourth data includes at least one of the following: particle density, second particle velocity, second particle direction, and second particle transparency.

[0160] The step of calculating the fourth data corresponding to each grid cell based on the number of particles included in each grid cell and the first data corresponding to the particles includes:

[0161] Based on the number of particles included in each of the grid cells, the particle density corresponding to each grid cell is calculated, specifically by comparing the number of particles included in each grid cell with a preset particle number threshold to obtain the particle density corresponding to that grid cell; and / or,

[0162] Based on the number of particles included in each grid cell and the first particle velocity corresponding to each particle, the second particle velocity corresponding to each grid cell is calculated. Specifically, this involves averaging the first particle velocities corresponding to the particles included in each grid cell to obtain the second particle velocity corresponding to that grid cell; and / or,

[0163] Based on the number of particles included in each grid cell and the first particle direction corresponding to each particle, the second particle direction corresponding to each grid cell is calculated. Specifically, this involves averaging the first particle directions corresponding to the particles included in each grid cell to obtain the second particle direction corresponding to that grid cell; and / or,

[0164] Based on the number of particles included in each grid and the first particle transparency corresponding to the particles, the second particle transparency corresponding to each grid is calculated. Specifically, the first particle transparency corresponding to the particles included in the grid is averaged to obtain the second particle transparency corresponding to the grid.

[0165] Optionally, the step of recording the fourth data corresponding to each grid cell in the pixel of the first texture map according to the coordinates of the first texture map in the world coordinate system includes:

[0166] Gaussian blur is applied to calculate the pixel value of each pixel in the first texture map.

[0167] The weather effect rendering unit 804 is used to render the weather effect of the first virtual scene at the first rendering time according to the first texture map corresponding to the first virtual scene.

[0168] Optionally, rendering the weather effect corresponding to the first virtual scene at the first rendering time based on the first texture map corresponding to the first virtual scene includes:

[0169] The first texture map and a preset first image are sampled to render the basic weather effect corresponding to the first virtual scene. The first image is used to indicate the height distribution of at least one weather element included in the weather effect in the first virtual scene.

[0170] A second image is sampled and rendered with detailed effects on the basic weather effect to form the weather effect corresponding to the first virtual scene. The second image is used to indicate the detailed rendering effect of the at least one weather element.

[0171] Optionally, when the weather element is ground fog, it is also used for:

[0172] Based on the terrain elevation map corresponding to the first virtual scene, and on the basis of the weather effect, the ground fog is moved to the height indicated by the terrain elevation map.

[0173] Optionally, when the weather element is rainfall, it is also used for:

[0174] Based on the first data recorded in the first texture map, a third image is obtained, and the third image is used to indicate the flow direction of the rainfall;

[0175] Based on the third image, rainfall occurs along the direction of flow, building upon the aforementioned weather effect.

[0176] Optionally, the device further includes a close-up rendering unit for:

[0177] In response to the camera switching to a first weather element included in the weather effect, a particle patch corresponding to a first region in the first weather element is created, wherein the first weather element is any weather element in the weather effect, and the first region is the region of the first weather element currently located in front of the camera;

[0178] Based on the particle patch, the first region of the first weather element is rendered on the basis of the weather effect.

[0179] Optionally, the device is also used for:

[0180] According to the second game data corresponding to the second virtual scene, a second number of particle emission points are placed in the second virtual scene, wherein the second virtual scene includes at least a portion of the virtual scene other than the first virtual scene, and the second game data is used to represent the weather state of the second virtual scene at the first rendering time;

[0181] Control the second number of particle emission points to emit multiple particles, and acquire the second data corresponding to the multiple particles;

[0182] The second data corresponding to the plurality of particles is recorded in the second texture map corresponding to the second virtual scene;

[0183] The weather effect of the second virtual scene at the first rendering time is rendered based on the second texture map corresponding to the second virtual scene.

[0184] Optionally, the device is also used for:

[0185] Based on the third game data corresponding to the first virtual scene, a third number of particle emission points are placed in the first virtual scene, wherein the third game data is used to represent the weather state of the first virtual scene at a second rendering time, and the second rendering time is any rendering time after the first rendering time.

[0186] Control the third number of particle emission points to emit multiple particles, and acquire the third data corresponding to the multiple particles;

[0187] The third data corresponding to the plurality of particles is recorded in the third texture map corresponding to the first virtual scene;

[0188] The weather effect corresponding to the first virtual scene at the second rendering time is rendered based on the third texture map corresponding to the first virtual scene.

[0189] The fourth embodiment of this application provides an electronic device. Figure 9 This is a schematic diagram of the structure of the electronic device provided in this embodiment.

[0190] like Figure 9 As shown, the electronic device provided in this embodiment includes: a memory 901 and a processor 902;

[0191] The memory 901 is used to store computer instructions for executing rendering methods of weather effects in a virtual scene;

[0192] The processor 902 is configured to execute computer instructions stored in the memory 901 to perform the following operations:

[0193] Based on the first game data corresponding to the first virtual scene, a first number of particle emission points are placed in the first virtual scene, wherein the first virtual scene includes at least a portion of the virtual scene, and the first game data is used to represent the weather state of the first virtual scene at a first rendering time, and the first rendering time is any rendering time for rendering the weather effect of the virtual scene.

[0194] Control the first number of particle emission points to emit multiple particles, and acquire the first data corresponding to the multiple particles;

[0195] The first data corresponding to the plurality of particles is recorded in the first texture map corresponding to the first virtual scene;

[0196] Render the weather effect corresponding to the first virtual scene at the first rendering time based on the first texture map corresponding to the first virtual scene.

[0197] Optionally, the following operations may also be performed:

[0198] According to the second game data corresponding to the second virtual scene, a second number of particle emission points are placed in the second virtual scene, wherein the second virtual scene includes at least a portion of the virtual scene other than the first virtual scene, and the second game data is used to represent the weather state of the second virtual scene at the first rendering time;

[0199] Control the second number of particle emission points to emit multiple particles, and acquire the second data corresponding to the multiple particles;

[0200] The second data corresponding to the plurality of particles is recorded in the second texture map corresponding to the second virtual scene;

[0201] The weather effect of the second virtual scene at the first rendering time is rendered based on the second texture map corresponding to the second virtual scene.

[0202] Optionally, the following operations may also be performed:

[0203] Based on the third game data corresponding to the first virtual scene, a third number of particle emission points are placed in the first virtual scene, wherein the third game data is used to represent the weather state of the first virtual scene at a second rendering time, and the second rendering time is any rendering time after the first rendering time.

[0204] Control the third number of particle emission points to emit multiple particles, and acquire the third data corresponding to the multiple particles;

[0205] The third data corresponding to the plurality of particles is recorded in the third texture map corresponding to the first virtual scene;

[0206] The weather effect corresponding to the first virtual scene at the second rendering time is rendered based on the third texture map corresponding to the first virtual scene.

[0207] Optionally, before the step of placing a first number of particle emission points in the first virtual scene according to the first game data corresponding to the first virtual scene, the following is also performed:

[0208] In the world coordinate system, create the first particle simulation system corresponding to the first virtual scene;

[0209] The step of deploying a first number of particle emission points in the first virtual scene based on the first game data corresponding to the first virtual scene includes:

[0210] Based on the first particle simulation system, and according to the first game data corresponding to the first virtual scene, a first number of particle emission points are deployed in the first virtual scene.

[0211] Optionally, the first game data is recorded in the fourth texture map corresponding to the first virtual scene; the step of placing a first number of particle emission points in the first virtual scene according to the first game data corresponding to the first virtual scene includes:

[0212] Read the fourth texture map, and based on the coordinates of the fourth texture map in the world coordinate system and the preset first granularity value, evenly distribute the fourth number of particle emission points in the first virtual scene;

[0213] Based on the first game data in the fourth texture map corresponding to each particle emission point and a preset game data threshold, particle emission points whose first game data is less than the game data threshold are removed from the fourth number of particle emission points to form the first number of particle emission points.

[0214] Optionally, before the step of controlling the first number of particle emission points to emit multiple particles, the following is also performed:

[0215] Based on the weather conditions of the first virtual scene at the first rendering time, a mechanical model is created, which is used to indicate the emission state of the particles at the particle emission point.

[0216] Optionally, controlling the first number of particle emission points to emit multiple particles and acquiring first data corresponding to the multiple particles includes:

[0217] According to the mechanical model, the first number of particle emission points are controlled to emit the plurality of particles having a first state parameter;

[0218] The first state parameters of the plurality of particles are used as the first data corresponding to the plurality of particles.

[0219] Optionally, before the step of recording the first data corresponding to the plurality of particles in the first texture map corresponding to the first virtual scene, the following is also performed:

[0220] The first virtual scene is divided into a grid according to a preset second granularity value, and the grid includes multiple cells of the same size.

[0221] Optionally, recording the first data corresponding to the plurality of particles in the first texture map corresponding to the first virtual scene includes:

[0222] Calculate the fourth data corresponding to each grid cell based on the number of particles included in each grid cell and the first data corresponding to the particles.

[0223] Based on the coordinates of the first texture map in the world coordinate system, the fourth data corresponding to each of the grid cells is recorded in the pixel of the first texture map.

[0224] Optionally, the first data includes at least one of the following: first particle velocity, first particle direction, and first particle transparency; the fourth data includes at least one of the following: particle density, second particle velocity, second particle direction, and second particle transparency.

[0225] The step of calculating the fourth data corresponding to each grid cell based on the number of particles included in each grid cell and the first data corresponding to the particles includes:

[0226] Based on the number of particles included in each of the grid cells, the particle density corresponding to each grid cell is calculated, specifically by comparing the number of particles included in each grid cell with a preset particle number threshold to obtain the particle density corresponding to that grid cell; and / or,

[0227] Based on the number of particles included in each grid cell and the first particle velocity corresponding to each particle, the second particle velocity corresponding to each grid cell is calculated. Specifically, this involves averaging the first particle velocities corresponding to the particles included in each grid cell to obtain the second particle velocity corresponding to that grid cell; and / or,

[0228] Based on the number of particles included in each grid cell and the first particle direction corresponding to each particle, the second particle direction corresponding to each grid cell is calculated. Specifically, this involves averaging the first particle directions corresponding to the particles included in each grid cell to obtain the second particle direction corresponding to that grid cell; and / or,

[0229] Based on the number of particles included in each grid and the first particle transparency corresponding to the particles, the second particle transparency corresponding to each grid is calculated. Specifically, the first particle transparency corresponding to the particles included in the grid is averaged to obtain the second particle transparency corresponding to the grid.

[0230] Optionally, the step of recording the fourth data corresponding to each grid cell in the pixel of the first texture map according to the coordinates of the first texture map in the world coordinate system includes:

[0231] Gaussian blur is applied to calculate the pixel value of each pixel in the first texture map.

[0232] Optionally, the volumetric rendering system renders the weather effect corresponding to the first virtual scene at the first rendering time based on the first texture map corresponding to the first virtual scene, including:

[0233] The first texture map and a preset first image are sampled to render the basic weather effect corresponding to the first virtual scene. The first image is used to indicate the height distribution of at least one weather element included in the weather effect in the first virtual scene.

[0234] A second image is sampled and rendered with detailed effects on the basic weather effect to form the weather effect corresponding to the first virtual scene. The second image is used to indicate the detailed rendering effect of the at least one weather element.

[0235] Optionally, when the weather element is ground fog, the following also applies:

[0236] Based on the terrain elevation map corresponding to the first virtual scene, and on the basis of the weather effect, the ground fog is moved to the height indicated by the terrain elevation map.

[0237] Optionally, when the weather element is rainfall, the following also applies:

[0238] Based on the first data recorded in the first texture map, a third image is obtained, and the third image is used to indicate the flow direction of the rainfall;

[0239] Based on the third image, rainfall occurs along the direction of flow, building upon the aforementioned weather effect.

[0240] Optional, also execute:

[0241] In response to the camera switching to a first weather element included in the weather effect, a particle patch corresponding to a first region in the first weather element is created, wherein the first weather element is any weather element in the weather effect, and the first region is the region of the first weather element currently located in front of the camera;

[0242] Based on the particle patch, the first region of the first weather element is rendered on the basis of the weather effect.

[0243] The fifth embodiment of this application provides a computer-readable storage medium, which includes computer instructions that, when executed by a processor, are used to implement the methods described in the embodiments of this application.

[0244] It should be noted that the relational terms such as "first" and "second" used in this document are only used to distinguish one entity or operation from another, and do not require or imply any actual relationship or order between these entities or operations. Furthermore, "including," "having," "containing," and other similar terms are synonymous, and the conclusion of any one or more items following any of the foregoing words is open-ended; none of the foregoing terms indicates that the one or more items have been exhaustively listed, or are limited to only one or more of the listed items.

[0245] When used herein, unless otherwise expressly stated, the term "or" includes all possible combinations except those that are impractical. For example, if expressed as a database may include A or B, then unless otherwise specified or impractical, it may include database A, or B, or A and B. As a second example, if expressed as a database may include A, B, or C, then unless otherwise specified or impractical, the database may include database A, or B, or C, or A and B, or A and C, or B and C, or A and B and C.

[0246] It is worth noting that the above embodiments can be implemented by hardware or software (program code), or a combination of hardware and software. If implemented by software, it can be stored in the above-described computer-readable medium. When executed by a processor, the software can perform the methods disclosed above. The computing units and other functional units described in this disclosure can be implemented by hardware or software, or a combination of hardware and software. Those skilled in the art will also understand that the above-described multiple modules / units can be combined into one module / unit, and each of the above-described modules / units can be further divided into multiple sub-modules / sub-units.

[0247] In the foregoing detailed description, embodiments have been described with reference to numerous specific details, which may vary depending on the implementation. Certain adaptations and modifications can be made to the embodiments. Other implementations will be readily apparent to those skilled in the art from the specific embodiments disclosed herein. This specification and examples are for illustrative purposes only, and the true scope and essence of this application are defined by the claims. The sequence of steps shown in the figures is also for illustrative purposes only and is not intended to limit to any particular step or order. Therefore, those skilled in the art will recognize that these steps can be performed in different orders when implementing the same method.

[0248] Exemplary embodiments are disclosed in the figures and detailed description of this application. However, many variations and modifications can be made to these embodiments. Accordingly, although specific terms are used, they are only general and descriptive and not for limiting purposes.

Claims

1. A method for rendering weather effects in a virtual scene, characterized in that, The method includes: Based on the first game data corresponding to the first virtual scene, a first number of particle emission points are deployed in the first virtual scene. The first virtual scene includes at least a portion of the virtual scene's area. The first game data represents the weather state of the first virtual scene at a first rendering time, where the first rendering time is any rendering time used to render the weather effect of the virtual scene. The first game data is recorded in a fourth texture map corresponding to the first virtual scene. Deploying the first number of particle emission points includes: reading the fourth texture map; uniformly deploying the fourth number of particle emission points in the first virtual scene based on the coordinates of the fourth texture map in the world coordinate system and a preset first granularity value; and removing particle emission points whose first game data is less than the game data threshold from the fourth number of particle emission points, based on the first game data in the fourth texture map corresponding to each particle emission point and a preset game data threshold, to form the first number of particle emission points. Control the first number of particle emission points to emit multiple particles, and acquire the first data corresponding to the multiple particles; The first data corresponding to the plurality of particles is recorded in the first texture map corresponding to the first virtual scene; Render the weather effect corresponding to the first virtual scene at the first rendering time based on the first texture map corresponding to the first virtual scene.

2. The method according to claim 1, characterized in that, The method further includes: According to the second game data corresponding to the second virtual scene, a second number of particle emission points are placed in the second virtual scene, wherein the second virtual scene includes at least a portion of the virtual scene other than the first virtual scene, and the second game data is used to represent the weather state of the second virtual scene at the first rendering time; Control the second number of particle emission points to emit multiple particles, and acquire the second data corresponding to the multiple particles; The second data corresponding to the plurality of particles is recorded in the second texture map corresponding to the second virtual scene; The weather effect of the second virtual scene at the first rendering time is rendered based on the second texture map corresponding to the second virtual scene.

3. The method according to claim 1, characterized in that, The method further includes: Based on the third game data corresponding to the first virtual scene, a third number of particle emission points are placed in the first virtual scene, wherein the third game data is used to represent the weather state of the first virtual scene at a second rendering time, and the second rendering time is any rendering time after the first rendering time. Control the third number of particle emission points to emit multiple particles, and acquire the third data corresponding to the multiple particles; The third data corresponding to the plurality of particles is recorded in the third texture map corresponding to the first virtual scene; The weather effect corresponding to the first virtual scene at the second rendering time is rendered based on the third texture map corresponding to the first virtual scene.

4. The method according to claim 1, characterized in that, Before the step of placing a first number of particle emission points in the first virtual scene based on the first game data corresponding to the first virtual scene, the method further includes: In the world coordinate system, create the first particle simulation system corresponding to the first virtual scene; The step of deploying a first number of particle emission points in the first virtual scene based on the first game data corresponding to the first virtual scene includes: Based on the first particle simulation system, and according to the first game data corresponding to the first virtual scene, a first number of particle emission points are deployed in the first virtual scene.

5. The method according to claim 1, characterized in that, Prior to the step of controlling the first number of particle emission points to emit multiple particles, the method further includes: Based on the weather conditions of the first virtual scene at the first rendering time, a mechanical model is created, which is used to indicate the emission state of the particles at the particle emission point.

6. The method according to claim 5, characterized in that, The step of controlling the first number of particle emission points to emit multiple particles and acquiring first data corresponding to the multiple particles includes: According to the mechanical model, the first number of particle emission points are controlled to emit the plurality of particles having a first state parameter; The first state parameters of the plurality of particles are used as the first data corresponding to the plurality of particles.

7. The method according to claim 1, characterized in that, Before the step of recording the first data corresponding to the plurality of particles in the first texture map corresponding to the first virtual scene, the method further includes: The first virtual scene is divided into a grid according to a preset second granularity value, and the grid includes multiple cells of the same size.

8. The method according to claim 7, characterized in that, The step of recording the first data corresponding to the plurality of particles in the first texture map corresponding to the first virtual scene includes: Calculate the fourth data corresponding to each grid cell based on the number of particles included in each grid cell and the first data corresponding to the particles. Based on the coordinates of the first texture map in the world coordinate system, the fourth data corresponding to each of the grid cells is recorded in the pixel of the first texture map.

9. The method according to claim 8, characterized in that, The first data includes at least one of the following: first particle velocity, first particle direction, and first particle transparency; the fourth data includes at least one of the following: particle density, second particle velocity, second particle direction, and second particle transparency. The step of calculating the fourth data corresponding to each grid cell based on the number of particles included in each grid cell and the first data corresponding to the particles includes: Based on the number of particles included in each of the grid cells, the particle density corresponding to each grid cell is calculated, specifically by comparing the number of particles included in each grid cell with a preset particle number threshold to obtain the particle density corresponding to that grid cell; and / or, Based on the number of particles in each grid cell and the first particle velocity corresponding to each particle, the second particle velocity corresponding to each grid cell is calculated. Specifically, this involves averaging the first particle velocities corresponding to the particles in each grid cell to obtain the second particle velocity corresponding to that grid cell; and / or, Based on the number of particles included in each grid cell and the first particle direction corresponding to each particle, the second particle direction corresponding to each grid cell is calculated. Specifically, this involves averaging the first particle directions corresponding to the particles included in each grid cell to obtain the second particle direction corresponding to that grid cell; and / or, Based on the number of particles included in each grid and the first particle transparency corresponding to the particles, the second particle transparency corresponding to each grid is calculated. Specifically, the average value of the first particle transparency corresponding to the particles included in the grid is processed to obtain the second particle transparency corresponding to the grid.

10. The method according to claim 8, characterized in that, The step of recording the fourth data corresponding to each grid cell in the pixel of the first texture map according to the coordinates of the first texture map in the world coordinate system includes: Gaussian blur is applied to calculate the pixel value of each pixel in the first texture map.

11. The method according to claim 1, characterized in that, The step of rendering the weather effect of the first virtual scene at the first rendering time based on the first texture map corresponding to the first virtual scene includes: The first texture map and a preset first image are sampled to render the basic weather effect corresponding to the first virtual scene. The first image is used to indicate the height distribution of at least one weather element included in the weather effect in the first virtual scene. A second image is sampled and rendered with detailed effects on the basic weather effect to form the weather effect corresponding to the first virtual scene. The second image is used to indicate the detailed rendering effect of the at least one weather element.

12. The method according to claim 11, characterized in that, When the weather element is ground fog, the method further includes: Based on the terrain elevation map corresponding to the first virtual scene, and on the basis of the weather effect, the ground fog is moved to the height indicated by the terrain elevation map.

13. The method according to claim 11, characterized in that, When the weather element is rainfall, the method further includes: Based on the first data recorded in the first texture map, a third image is obtained, and the third image is used to indicate the flow direction of the rainfall; Based on the third image, rainfall occurs along the direction of flow, building upon the aforementioned weather effect.

14. The method according to claim 1, characterized in that, The method further includes: In response to the camera switching to a first weather element included in the weather effect, a particle patch corresponding to a first region in the first weather element is created, wherein the first weather element is any weather element in the weather effect, and the first region is the region of the first weather element currently located in front of the camera. Based on the particle patch, the first region of the first weather element is rendered on the basis of the weather effect.

15. A weather system in a game, characterized in that, The system includes: a particle simulation system and a volumetric rendering system; wherein, The particle simulation system includes: a deployment module, a control module, and a recording module; The deployment module is used to deploy a first number of particle emission points in the first virtual scene according to the first game data corresponding to the first virtual scene. The first virtual scene includes at least a portion of the virtual scene, and the first game data represents the weather state of the first virtual scene at a first rendering time. The first rendering time is any rendering time used to render the weather effect of the virtual scene. The first game data is recorded in a fourth texture map corresponding to the first virtual scene. Deploying the first number of particle emission points includes: reading the fourth texture map; uniformly deploying the fourth number of particle emission points in the first virtual scene according to the coordinates of the fourth texture map in the world coordinate system and a preset first granularity value; and removing particle emission points whose first game data is less than the game data threshold from the fourth number of particle emission points, based on the first game data in the fourth texture map corresponding to each particle emission point and a preset game data threshold, to form the first number of particle emission points. The control module is used to control the first number of particle emission points to emit multiple particles and to acquire first data corresponding to the multiple particles; The recording module is used to record the first data corresponding to the plurality of particles in the first texture map corresponding to the first virtual scene; The volume rendering system is used to render the weather effect corresponding to the first virtual scene at the first rendering time based on the first texture map corresponding to the first virtual scene.

16. A rendering device for weather effects in a virtual scene, characterized in that, The device includes: a particle emission point deployment unit, a particle emission control unit, a particle data recording unit, and a weather effect rendering unit; The particle emission point placement unit is used to place a first number of particle emission points in the first virtual scene according to the first game data corresponding to the first virtual scene. The first virtual scene includes at least a portion of the virtual scene, and the first game data represents the weather state of the first virtual scene at a first rendering time. The first rendering time is any rendering time used to render the weather effect of the virtual scene. The first game data is recorded in a fourth texture map corresponding to the first virtual scene. Placing the first number of particle emission points includes: reading the fourth texture map; uniformly placing the fourth number of particle emission points in the first virtual scene according to the coordinates of the fourth texture map in the world coordinate system and a preset first granularity value; and removing particle emission points whose first game data is less than the game data threshold from the fourth number of particle emission points, based on the first game data in the fourth texture map corresponding to each particle emission point and a preset game data threshold, to form the first number of particle emission points. The particle emission control unit is used to control the first number of particle emission points to emit multiple particles and to acquire first data corresponding to the multiple particles; The particle data recording unit is used to record the first data corresponding to the plurality of particles in the first texture map corresponding to the first virtual scene. The weather effect rendering unit is used to render the weather effect of the first virtual scene at the first rendering time based on the first texture map corresponding to the first virtual scene.

17. An electronic device, characterized in that, include: Memory, processor; The memory is used to store one or more computer instructions; The processor is configured to execute one or more computer instructions to implement the method as described in any one of claims 1-14.

18. A computer-readable storage medium storing one or more computer instructions thereon, characterized in that, When this instruction is executed by the processor, it performs the method as described in any one of claims 1-14.

Citation Information

Patent Citations

  • Rendering method of dynamic fluid effect and apparatus thereof

    CN106504311A

  • Weather rendering method and device in virtual environment, equipment and storage medium

    CN112263837A