Fog effect rendering method and device in virtual scene, electronic device and storage medium

By attaching decal components and mesh models to a virtual scene, the fog effect is controlled according to the visible range, solving the problem of poor control over the naturalness of fog and the visible range in existing technologies, and achieving precise fog distance setting and optimized fog performance.

CN122134903APending Publication Date: 2026-06-02NETEASE (HANGZHOU) NETWORK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2024-12-02
Publication Date
2026-06-02

Smart Images

  • Figure CN122134903A_ABST
    Figure CN122134903A_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of rendering technology, providing a method, apparatus, electronic device, and storage medium for rendering fog effects in a virtual scene. The method includes: in response to a target object entering a fog effect area, determining a pre-set visible range of the target object within the fog effect area; determining, based on the visible range, a decal component for simulating a target fog effect within the visible range and a mesh model matching the size of the visible range; attaching the decal component and the mesh model to the target object so that the decal component and the mesh model move with the target object within the fog effect area, forming a fog effect mask for the virtual scene outside the visible range; and controlling the rendering and display of the target fog effect determined based on the decal component, and the virtual scene under the influence of the target fog effect, on the target object's terminal device when the target object moves within the fog effect area. This method significantly enhances the fog effect rendering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of rendering technology, and in particular to a method, apparatus, electronic device, and storage medium for rendering fog effects in a virtual scene. Background Technology

[0002] In game scenarios, fog is often used as a tactical tool or environmental effect. Existing methods for implementing fog effects generally use a fog component. This component adjusts the fog's color and density to achieve the effect that the farther the object is from the player, the higher the fog concentration obscures it.

[0003] However, when using fog components to achieve a masking effect, only the fog density parameter can control the masking effect. The effect achieved in terms of the naturalness of the fog and the control of the visibility range is not good, that is, the fog performance is not good. Summary of the Invention

[0004] In view of this, the purpose of this disclosure is to provide a method, apparatus, electronic device and storage medium for rendering fog effects in a virtual scene. By attaching a decal component for simulating the fog effect of a target within the visible range and a mesh model that matches the size of the visible range to the target object, the method achieves precise setting of the fog start distance and the distance at which the fog completely occludes the object. This results in better performance in terms of the naturalness of the fog and the control of the visible range, and greatly enhances the fog performance.

[0005] In a first aspect, embodiments of this disclosure provide a method for rendering fog effects in a virtual scene, wherein the virtual scene includes a fog effect area, and the method for rendering fog effects in the virtual scene includes:

[0006] In response to a target object entering the fog effect area, a pre-set visible range of the target object within the fog effect area is determined, wherein the visible range is determined based on the influence of the fog effect area on the field of vision of the target object;

[0007] Based on the visible range, a decal component for simulating a target fog effect within the visible range and a mesh model matching the size of the visible range are determined, wherein the size of the decal component is larger than the size of the mesh model;

[0008] The decal component and the mesh model are attached to the target object so that the decal component and the mesh model move with the target object within the fog effect area, forming a fog effect mask for the virtual scene outside the visible range;

[0009] When the target object moves within the fog effect area, the system controls the rendering and display of the target fog effect determined based on the decal component, as well as the virtual scene under the influence of the target fog effect, on the target object's terminal device.

[0010] Secondly, embodiments of this disclosure provide a fog effect rendering device for a virtual scene, wherein the virtual scene includes a fog effect area, and the fog effect rendering device for the virtual scene includes:

[0011] The first determining module is used to determine the pre-set visible range of the target object within the fog effect area in response to the target object entering the fog effect area, wherein the visible range is determined based on the influence of the fog effect area on the field of vision of the target object;

[0012] The second determining module is used to determine, based on the visible range, a decal component for simulating a target fog effect within the visible range and a mesh model matching the size of the visible range, wherein the size of the decal component is larger than the size of the mesh model;

[0013] The attachment module is used to attach the decal component and the mesh model to the target object, so that the decal component and the mesh model move with the target object within the fog effect area, and form a fog effect mask for the virtual scene outside the visible range;

[0014] The rendering module is used to control the rendering and display of the target fog effect determined based on the decal component, and the virtual scene under the influence of the target fog effect, on the target object's terminal device when the target object moves within the fog effect area.

[0015] Thirdly, embodiments of this disclosure provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the fog effect rendering method in the virtual scene described above.

[0016] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the fog effect rendering method in the virtual scene described above.

[0017] The embodiments disclosed herein bring the following beneficial effects:

[0018] The aforementioned fog effect rendering method, apparatus, electronic device, and storage medium in the virtual scene, in response to a target object entering the fog effect area, determine a pre-set visible range corresponding to the target object within the fog effect area, wherein the visible range is determined based on the influence of the fog effect area on the target object's field of vision; based on the visible range, determine a decal component for simulating the target fog effect within the visible range and a mesh model matching the size of the visible range, wherein the size of the decal component is larger than the size of the mesh model; attach the decal component and the mesh model to the target object so that the decal component and the mesh model move with the target object within the fog effect area, forming a fog effect mask for the virtual scene outside the visible range; when the target object moves within the fog effect area, control the rendering and display of the target fog effect determined based on the decal component, and the virtual scene under the influence of the target fog effect on the target object's terminal device. In this method, by attaching a decal component used to simulate the fog effect of the target within the visible range and a mesh model that matches the size of the visible range to the target object, the method achieves precise setting of the fog start distance and the distance at which the fog completely obscures the object. This results in better control over the naturalness of the fog and the visible range, and greatly enhances the fog performance.

[0019] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the disclosure. The objects and other advantages of this disclosure are realized and obtained through the structures particularly pointed out in the description, claims and drawings.

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

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

[0022] Figure 1 A schematic diagram of an embodiment of the fog effect with a fog density parameter of 4 provided in this disclosure;

[0023] Figure 2 A schematic diagram of an embodiment of the fog effect rendering method in a virtual scene provided in this disclosure;

[0024] Figure 3 A schematic diagram of an embodiment of the specific functions implemented by the fog effect rendering method in a virtual scene provided in this disclosure;

[0025] Figure 4 A schematic diagram of an embodiment of a target fog effect determined based on a decal component, and a virtual scene under the influence of the target fog effect, provided in this disclosure.

[0026] Figure 5 A schematic diagram illustrating a target fog effect determined by a decal component, as provided in an embodiment of this disclosure, and another embodiment of a virtual scene under the influence of the target fog effect;

[0027] Figure 6 A schematic diagram of an embodiment of the material creation panel provided in this disclosure;

[0028] Figure 7 A schematic diagram illustrating an embodiment of the effect of a decal component for simulating a target fog effect within the visible range, as provided in this disclosure.

[0029] Figure 8 A schematic diagram of one embodiment of the textured, gradient fog effect provided in this disclosure;

[0030] Figure 9 A schematic diagram of a fog effect rendering device in a virtual scene provided in an embodiment of this disclosure;

[0031] Figure 10 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

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

[0033] In game scenarios, fog is often used as a tactical tool or environmental effect to provide players with different strategic options and gameplay experiences. For example, fog can create a mysterious and tense atmosphere, or smoke grenades can be used to restrict the player's vision within a certain range, making it difficult to determine the enemy's location and increasing the challenge. Existing methods for implementing fog effects generally use fog components. These components adjust the fog's color and density to achieve the effect that the farther away an object is from the player, the higher the fog concentration obscuring that object becomes. Figure 1 As shown, Figure 1The image shows the fog effect with a fog density parameter of 4.

[0034] However, when using fog components to achieve a masking effect, only the fog density parameter can control the masking effect. The effect achieved in terms of the naturalness of the fog and the control of the visibility range is not good, that is, the fog performance is not good.

[0035] This embodiment provides a method, apparatus, electronic device, and storage medium for rendering fog effects in a virtual scene. It can be applied to fog effect rendering in virtual scenes with any interface, especially in virtual scenes within a game interface. The virtual scene includes a fog effect area.

[0036] The fog effect rendering method in a virtual scene in one embodiment of this disclosure can run on a terminal device or a server. The terminal device can be a local terminal device. When the fog effect rendering method in a virtual scene runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and client devices.

[0037] For ease of understanding, the specific process of this embodiment is described below. Please refer to [link / reference]. Figure 2 One embodiment of the fog effect rendering method in the virtual scene in this example includes the following steps:

[0038] Step 201: In response to the target object entering the fog effect area, determine the pre-set visible range of the target object within the fog effect area, wherein the visible range is determined based on the influence of the fog effect area on the target object's field of vision;

[0039] Here, by way of example rather than limitation, the following can be understood as: the fog effect area can be understood as an area used to simulate fog, smoke or other atmospheric effects; the target object can be an object manipulated by the user account, such as a virtual character or a movable virtual object; the area corresponding to the visible range is a three-dimensional spatial area, which can be a three-dimensional spherical area with the position of the target object in the fog effect area as the center point and a preset length as the radius; the target character is located at the center of the visible range; the shape of the visible range can also be determined based on the virtual camera's viewpoint or shooting angle.

[0040] Here, as an example rather than a limitation, the process involves obtaining the target object's position within the fog area in response to its entry into the fog area; determining the corresponding 3D region within the fog area based on a preset radius and the target object's position, and thus obtaining a pre-set visible range for the target object within the fog area. This visible range is used to ensure that the distance at which the target character's field of vision is limited remains constant within the fog area.

[0041] Step 202: Based on the visible range, determine a decal component and a mesh model that matches the size of the visible range for simulating the target fog effect within the visible range, wherein the size of the decal component is larger than the size of the mesh model.

[0042] Here, as an example rather than a limitation, it is noted that: the size of the decal component being larger than the size of the mesh model is beneficial for attaching the decal component to the mesh model; the size of the decal component can also be the same as the size of the mesh model; a mesh model matching the size of the visible area can be understood as a model corresponding to the scene within the visible area; the mesh model is used to form a mask for virtual scenes outside the visible area; and the mesh model is used to support the decal component.

[0043] Here, as an example and not a limitation, it is shown that before determining the decal components used to simulate the target fog effect within the visible range and a mesh model matching the size of the visible range, a decal material corresponding to the virtual scene has already been created; when determining the decal components used to simulate the target fog effect within the visible range and a mesh model matching the size of the visible range, it is possible to: obtain the size and shape of the visible range; based on the size and shape of the visible range and the position of the target character within the visible range, create a mesh model corresponding to the scene within the visible range so that the decal components cover the visible range, or obtain the visible... The size and shape of the area, and the position of the target character within the visible area, are determined. A mesh model is created centered on the position of the target character within the visible area. The size and shape of the mesh model are adjusted based on the size and shape of the visible area to match the size and shape of the mesh model within the visible area. The center position within the visible area is determined, which is the position of the target object within the visible area. Decal material is placed based on the center position within the visible area, and the size and shape of the decal material are adjusted to match the size and shape of the decal material within the visible area, or the decal material is attached to the mesh model to obtain the decal component.

[0044] Step 203: Attach the decal component and the mesh model to the target object so that the decal component and the mesh model move with the target object within the fog effect area, and form a fog effect mask for the virtual scene outside the visible range.

[0045] In this context, attaching the decal component and mesh model to the target object can be understood as: attaching the decal component and mesh model to the target object itself, or attaching the decal component and mesh model to the virtual camera bound to (corresponding to) the target object, so that when the target object moves within the fog effect area, the virtual camera corresponding to the target object moves accordingly, thereby making the decal component and mesh model move with the target object within the fog effect area.

[0046] As an example, and not a limitation, attaching a decal component and a mesh model to a target object can be done in the following ways: attaching the decal component to the mesh model, and attaching the mesh model to which the decal component is attached to the target object; or, attaching the decal component to the target object and attaching the mesh model to the decal component; or, attaching the mesh model to the decal component and attaching the decal component to which the mesh model is attached to the target object.

[0047] By attaching decal components and mesh models to the target object to completely obscure objects outside the visible range, a fog effect that follows the character's movement is achieved. This enhances the dynamic and expressive effects of the fog effect, enriches the details of the virtual character's surface, and optimizes the visual hierarchy.

[0048] Step 204: When the target object moves within the fog effect area, control the rendering and display of the target fog effect determined based on the decal component, as well as the virtual scene under the influence of the target fog effect, on the target object's terminal device.

[0049] As an example, and not a limitation, the process involves setting up the camera, rendering path, and rendering parameters, as well as determining the rendering engine. When the target object moves within the fog area, the system controls the rendering engine on the target object's terminal device to generate a virtual scene under the influence of the target fog effect, based on the set camera, rendering path, and rendering parameters, as well as the decal components and mesh models attached to the target object.

[0050] As an example, and not a limitation, the specific functions achieved by the fog effect rendering method in the virtual scene disclosed herein are as follows: the player (i.e., the target character) can see the scene, character, and effects within the visible range, but cannot see any objects outside the visible range; any objects outside the visible range are completely filled with fog, making it impossible to determine their location; fog exists within the visible range, but completely obscures objects beyond that range, meaning objects outside the visible range are completely obscured and not displayed in the virtual scene affected by the target fog effect. Figure 3 As shown, Figure 3 As shown, character number 2 is within the player's field of view, while character number 3 is outside. The player can see character number 2 but not character number 3. The specific target fog effect determined by the decal component, and the virtual scene affected by this target fog effect, are visible. Figure 4 and Figure 5 , Figure 4 The image shows objects outside the visible range being completely obscured; these objects are not displayed in the virtual scene affected by the fog effect. Figure 5 The image shows objects within the visible range displayed in a virtual scene under the influence of the target fog effect. Their visibility (or display level) is affected by the target fog effect.

[0051] It should be noted that only elements within the visible scene area need to be rendered; elements outside the visible scene area do not need to be rendered. The fog effect rendering method for virtual scenes provided in this disclosure is applicable to virtual scenes corresponding to first-person or third-person perspectives.

[0052] The aforementioned fog rendering method in the virtual scene achieves precise setting of the fog initiation distance and the distance at which the fog completely obscures objects by attaching a decal component used to simulate fog effects within the visible range and a mesh model matching the size of the visible range to the target object. This results in superior performance in terms of both the naturalness of the fog and control over the visible range, significantly enhancing the fog's visual impact. It creates a natural and believable fog environment, improving the exploration experience in competitive games.

[0053] In one implementation, when determining the decal component for simulating a target fog effect within the visible range based on the visible range, the following steps can be taken: create a decal material for a virtual scene; calculate the distance between the coordinates of any pixel within the visible range and the center coordinates of the decal material to obtain the pixel distance; configure the fog effect parameters of the decal material based on the pixel distance to obtain the decal component for simulating a target fog effect within the visible range.

[0054] The decal material has a corresponding material creation panel, which displays material domain parameters and blend mode parameters. As an example, and not a limitation, it demonstrates that the decal material can be generated based on the settings of the material domain and blend mode parameters in the material creation panel. Specifically, the material domain parameter is set to Deferred Decal, and the blend mode parameter is set to Translucent. The material creation panel can be configured as follows: Figure 6 As shown, Figure 6 This shows the material creation panel for creating a sample virtual scene with decal materials.

[0055] The center coordinates of the decal material can be understood as the center coordinates of the visible area or the position of the target character within the visible area.

[0056] As an example, and not a limitation, it is to determine the coordinates of the center point of the decal material and the coordinates of any pixel within the visible range; based on a preset distance measurement algorithm, the coordinates of the center point of the decal material and the coordinates of any pixel within the visible range are calculated to obtain the pixel distance.

[0057] As an example, and not a limitation, it is described that at least one first node is created and connected, wherein the at least one first node is used to calculate the distance; the distance between the coordinates of any pixel within the visible range and the center coordinates of the decal material is calculated using the at least one first node to obtain the pixel distance.

[0058] By creating decal materials and configuring the fog effect parameters of the decal materials based on the distance between the coordinates of any pixel within the visible range and the center coordinates of the decal materials, it is possible to accurately set the fog start distance and the distance at which the fog completely obscures objects. This achieves dynamic fog effects, enhances the sense of scene depth, greatly enhances the fog performance, creates a natural and believable fog environment, and improves the exploration fun in competitive games.

[0059] In one implementation, the aforementioned fog effect parameters include an opacity parameter, which is used to simulate that the fog concentration gradually increases according to the distance between the target object and other objects within the visible range, so that the fog concentration is distributed from low to high.

[0060] As an example, and not a limitation, the fog rendering method in the virtual scene disclosed herein allows for precise setting of the fog initiation distance and the distance at which the fog completely obscures objects. The specific functions achieved are as follows: the player (which can be understood as the target character) can see the scene, characters, and effects within their visible range, but cannot see any objects outside their visible range. Any objects outside the visible range are completely filled with fog, making it impossible to determine their location. Within the visible range, fog increases in density as the object moves further away from the player, eventually achieving complete obscuration at the distance from the visible range. Objects outside the visible range are completely obscured and not displayed in the virtual scene affected by the target fog effect. The specific effects can be seen in [the image / description of the fog effect]. Figure 4 and Figure 5 .

[0061] As an example, and not a limitation, the opacity parameter in the fog effect parameters can be configured based on pixel distance, a preset fog effect start distance, and a preset fog effect start distance. This allows the opacity parameter to simulate a gradual increase in fog concentration according to the distance between the target object and other objects within the visible range, resulting in a fog concentration distribution from low to high. The fog effect start distance can be understood as the distance at which the fog effect begins to appear, i.e., the distance between the fog start point and the center point of the decal. The fog maximum distance can be understood as the distance between the fog maximum point and the center point of the decal material. The fog maximum point is the position where the fog completely obscures the object or the position where the fog effect reaches its strongest. Specifically, when the pixel distance is less than the fog effect start distance, the opacity parameter of the decal material is set to 0; when the pixel distance is greater than or equal to the fog maximum distance, the opacity parameter of the decal material is set to 1; when the pixel distance is greater than or equal to the fog effect start distance and less than the fog maximum distance, the opacity parameter of the decal material is calculated based on a preset exponential function or opacity formula, where the exponential function or opacity formula indicates that the fog effect gradually strengthens as the distance between the target object and other objects increases.

[0062] By gradually increasing the fog concentration according to the distance between the target object and other objects within the visible range, the fog concentration is distributed from low to high. This achieves the effect that the greater the distance between the target object and other objects, the higher the fog concentration of the occluded object, until it completely occludes the target object at the distance within the visible range (that is, it achieves the effect of precisely setting the distance at which the fog starts and the distance at which the fog completely occludes the object). This eliminates objects outside the distance of the densest fog, preventing them from appearing in the field of view, thus optimizing performance and reducing the number of rendered meshes.

[0063] In one implementation, when configuring the fog effect parameters of the decal material based on pixel distance to obtain a decal component for simulating a target fog effect within the visible range, the following steps can be taken: remapping the pixel distance, the preset fog starting point distance, and the preset fog maximum distance to obtain the remapped pixel distance, and the remapped fog starting point distance and fog maximum distance; calculating based on the remapped pixel distance and the remapped fog starting point distance and fog maximum distance to obtain a first calculation result, wherein the first calculation result is used to control the effect of attenuation softness; outputting the first calculation result to the opacity node of the decal material to obtain a decal component for simulating a target fog effect within the visible range; wherein the target fog effect is a fog effect with attenuation softness.

[0064] The fog starting point distance can be understood as the distance between the fog starting point and the center point of the decal material. The fog's densest point is the position where the fog completely obscures the object or where the fog effect is strongest.

[0065] As an example, and not a limitation, the process involves creating at least one second node and connecting it. Using these connected second nodes, the fog effect parameters of the decal material are configured based on the fog density distance and pixel distance to obtain a decal component that simulates the target fog effect within the visible range. Specifically, the pixel distance is remapped to a range of 0-1 to obtain the remapped pixel distance; the preset fog start distance is remapped to 0 to obtain the remapped fog start distance; and the preset fog density distance is remapped to 1 to obtain the remapped fog density distance. The remapped pixel distance, the remapped fog start distance, and the fog density distance are then saturated to obtain saturated parameter values. Finally, an exponential operation (Power) is performed based on preset control attenuation parameters and the saturated parameter values. The first calculation result is obtained, wherein the attenuation parameter can be the intensity value of the fog effect, to achieve calculation based on the remapped pixel distance, the remapped fog starting point distance, and the fog maximum density distance, thereby obtaining the first calculation result, which is used to control the effect of attenuation softness; the first calculation result is output to the opacity node of the decal material to obtain the decal component used to simulate the target fog effect within the visible range; wherein the target fog effect is a fog effect with attenuation softness, and the effect of the decal component used to simulate the target fog effect within the visible range can be as follows. Figure 7 As shown.

[0066] In one implementation, after performing an exponential operation (Power) based on preset control attenuation parameters and saturated parameter values ​​to obtain a first calculation result, the following can be further performed: In response to an adjustment command for the control attenuation parameters, performing an exponential operation based on the parameter values ​​indicated by the adjustment command and saturated parameter values ​​to obtain an adjusted first calculation result; and outputting the adjusted first calculation result to the opacity node of the decal material to obtain a decal component used to simulate a target fog effect within the visible range. This achieves adjustable opacity attenuation.

[0067] By remapping the pixel distance, the preset fog start distance, and the fog maximum distance, followed by saturation processing and exponential processing of the control attenuation parameters, and outputting the result to the opacity node of the decal material, a 0-1 gradient fog effect is achieved. This allows for precise setting of the fog start distance, the distance at which the fog completely obscures the object, and the degree of fog attenuation. It effectively controls the shape, naturalness, and visible range of the fog, enhancing the visual effect of the fog.

[0068] In one implementation, when configuring the fog effect parameters of the decal material based on pixel distance to obtain a decal component for simulating a target fog effect within the visible range, the following steps can be taken: remapping and calculating the pixel distance, the preset fog starting point distance, and the preset fog maximum distance to obtain a first calculation result, wherein the first calculation result is used to control the effect of attenuation softness; creating a world space tiled texture; calculating based on the world space tiled texture and the first calculation result to obtain a second calculation result; wherein the second calculation result is used to control the textured gradient effect; outputting the second calculation result to the opacity node of the decal material to obtain a decal component for simulating a target fog effect within the visible range; wherein the target fog effect is a textured, gradient fog effect.

[0069] The execution process of step "remapping and calculating the pixel distance, the preset fog starting point distance, and the preset fog maximum distance respectively to obtain the first calculation result" in this embodiment is similar to the execution process of step "remapping the pixel distance, the preset fog starting point distance, and the preset fog maximum distance respectively to obtain the remapped pixel distance, the remapped fog starting point distance, and the fog maximum distance; calculating based on the remapped pixel distance and the remapped fog starting point distance and the fog maximum distance to obtain the first calculation result" in the above embodiment, and will not be described again here.

[0070] As an example, and not a limitation, the world-space tiled texture is created by creating a texture node (WorldAlignedTexture) based on preset parameters, including but not limited to the texture map (TextureObject) to be tiled, the tile size (TextureSize), and the vertex coordinates (vertex coordinates).

[0071] As an example, and not a limitation, when calculating a second result based on a world-space tiled texture and a first calculation result, the following steps can be taken: smooth the saturated parameter values ​​to obtain smoothed interpolated parameter values; saturate the world-space tiled texture to obtain a saturated texture; interpolate the smoothed interpolated parameter values ​​and the saturated texture to obtain an interpolated texture; and multiply the interpolated texture and the first calculation result to obtain the second calculation result.

[0072] Here, by way of example and not limitation, a textured, gradient fog effect (the effect of a decal component used to simulate the fog effect of a target object within the visible range in a scene) can be as follows: Figure 8 As shown.

[0073] By remapping and calculating the pixel distance, the preset fog starting point distance, and the fog density distance, and setting the opacity parameter of the texture decal material in the world space tiling, a textured and gradient fog effect was achieved through a convenient calculation method.

[0074] In one implementation, when outputting the second calculation result to the opacity node of the decal material to obtain a decal component for simulating the target fog effect within the visible range, the following can be done: output the second calculation result to the opacity node of the decal material and add fog color parameters to obtain a decal component for simulating the target fog effect within the visible range; wherein, the target fog effect is a fog effect with texture, gradient, and color control.

[0075] As an example, and not a limitation, the method involves inputting a preset fog color parameter into the emissive color node of the decal material. This means setting the emissive color parameter of the decal material to the preset fog color parameter and configuring the base color parameter, roughness parameter, metallic properties, and specular reflection properties of the decal material. Specifically, the base color parameter, metallic properties, and specular reflection properties of the decal material are all set to 0, and the roughness parameter of the decal material is set to 1, thereby obtaining a decal component used to simulate the target fog effect within the visible range.

[0076] In one implementation, after outputting the second calculation result to the opacity node of the decal material and adding a fog color parameter to obtain a decal component for simulating the target fog effect within the visible range, it can further: respond to an adjustment command for the fog color parameter, output the second calculation result to the opacity node of the decal material, and configure the decal material based on the fog color parameter value indicated by the adjustment command to obtain a decal component for simulating the target fog effect within the visible range. This achieves controllable (adjustable) color of the decal fog.

[0077] By outputting the second calculation result to the opacity node of the decal material and adding fog color parameters, the color effect of the decal fog is achieved, giving the fog a textured, gradient, and color-controlled effect, further enhancing the visual and expressive effects of the fog effect.

[0078] In one implementation, when creating a world-space tiled texture, the following steps can be taken: First, a processed first texture is obtained by calculating based on a first time parameter, a first masking speed, pixel coordinates, and a first preset texture map; second, a processed second texture is obtained by calculating based on a second time parameter, a second masking speed, pixel coordinates, and a second preset texture map; third, the processed first texture and the processed second texture are added together to obtain a target texture; and fourth, the target texture is processed based on a preset noise power and a preset noise intensity to obtain a world-space tiled texture.

[0079] The created texture nodes include a first texture node and a second texture node. The first texture node is used to calculate based on a first time parameter, a first masking speed, pixel coordinates, and a first preset texture map to obtain the processed first texture. The second texture node is used to calculate based on a second time parameter, a second masking speed, pixel coordinates, and a second preset texture map to obtain the processed second texture.

[0080] Specifically, when calculating the processed first texture using the first texture node based on the first time parameter, the first masking speed, the coordinates of the pixel, and the first preset texture map, the following steps can be taken: The first preset texture map is processed based on the first preset value to obtain a processed first preset texture map; the processed first preset texture map is input into the texture object to be tiled in the first texture node; the first preset value is input into the tiling size (TextureSize) in the first texture node; the first masking speed and the first time parameter are multiplied to obtain a first multiplication result; the first multiplication result is added to the coordinates of the pixel to obtain the first coordinate with added time parameter; the first coordinate with added time parameter is input into the vertex coordinates (vertex coordinates) in the first texture node; and the processed first texture is obtained by performing calculations using the first texture node based on the input preset parameter.

[0081] Specifically, when calculating the processed second texture using the second texture node based on the second time parameter, the second masking speed, the pixel coordinates, and the second preset texture map, the following steps can be taken: The second preset texture map is processed based on the second preset value to obtain a processed second preset texture map; the processed second preset texture map is input into the texture object to be tiled in the second texture node; the second preset value is input into the tiling size (TextureSize) in the second texture node; the second masking speed and the second time parameter are multiplied to obtain a second multiplication result; the second multiplication result is added to the pixel coordinates to obtain a second coordinate with added time parameters; the second coordinate with added time parameters is input into the vertex coordinates (vertex coordinates) in the second texture node; and the processed second texture is obtained by performing calculations using the second texture node based on the input preset parameter.

[0082] In one implementation, after calculating the processed first texture based on a first time parameter, a first masking speed, pixel coordinates, and a first preset texture map, the following can be further performed: in response to an adjustment command for first target information, calculating the adjusted first texture based on the first information indicated by the adjustment command and the pixel coordinates, wherein the first target information includes at least one of the first time parameter, the first masking speed, and the first preset texture map. This achieves adjustability of the texture flow.

[0083] In one implementation, after calculating the processed second texture based on a second time parameter, a second masking speed, pixel coordinates, and a second preset texture map, the process can further involve: responding to an adjustment command for second target information, calculating the adjusted second texture based on the second information indicated by the adjustment command and the pixel coordinates, wherein the second target information includes at least one of the second time parameter, the second masking speed, and the second preset texture map. This achieves adjustability of the texture flow.

[0084] In one implementation, when processing the target texture based on a preset noise power and a preset noise intensity to obtain a world space tiled texture, the following steps can be taken: Calculate the target texture after noise power processing based on the preset noise power and the target texture; multiply the target texture after noise power processing with the preset noise intensity to obtain the world space tiled texture.

[0085] As an example and not a limitation, when calculating based on a preset noise power and a target texture to obtain a target texture after noise power processing, the following can be done: saturate the target texture to obtain a saturated target texture; or power the preset noise power and the saturated target texture to obtain a target texture after noise power processing.

[0086] In one implementation, the noise power and / or noise intensity can be determined based on the parameter value indicated by the adjustment instruction, in response to an adjustment instruction for a target parameter, wherein the target parameter includes noise power and / or noise intensity. This achieves adjustability of texture attenuation and intensity.

[0087] By processing time parameters, masking speed, pixel coordinates, and preset texture maps, two textures are obtained. These two textures are then combined to generate a world-space tiled texture, achieving texture flow and realizing dynamic texture effects and more refined texture control. By adding the first and second target textures, the repetition of texture tiling is reduced. By processing the target texture with preset noise power, the texture attenuation is adjusted. By multiplying the target texture after noise power processing with the preset noise intensity, the texture intensity is adjusted, giving the fog a better shape and naturalness, further enhancing the visual and expressive effects of the fog effect.

[0088] In one implementation, when attaching a decal component and a mesh model to a target object so that the decal component and mesh model move with the target object within the fog effect area and form a fog effect mask for the virtual scene outside the visible range, the following steps can be taken: attaching the decal component to the mesh model to form a fog effect mask for the virtual scene outside the visible range, thus obscuring the virtual scene outside the visible range; wherein, the mesh model is a three-dimensional sphere, and the simulated fog effect concentration is maximized when the size of the decal component reaches the size of the mesh model; attaching the mesh model with the decal component to the target object so that the fog effect mask moves with the target object within the fog effect area.

[0089] The radius of the mesh model is the value corresponding to the preset distance of the densest fog. The distance of the densest fog can be understood as the distance between the point of the densest fog and the center point of the decal material. The point of the densest fog is the position when the fog completely occludes the object or the position where the fog effect is strongest.

[0090] As an example, and not a limitation, attaching the mesh model of the attached decal component to the target object can be done by attaching the mesh model of the attached decal component to the target object itself, or by attaching the mesh model of the attached decal component to the virtual camera bound to (corresponding to) the target object.

[0091] By attaching decal components to a mesh model and then attaching the mesh model to the target object, a fog effect that follows the character's movement is achieved. This enhances the dynamic and expressive effects of the fog, enriches the details of the virtual character's surface, optimizes visual hierarchy, improves rendering performance, reduces the number of rendered meshes, ensures precise control of the fog effect within the target scene area, enhances the three-dimensionality of the fog effect, limits the rendering range of the fog effect, helps improve rendering efficiency, and helps maintain visual consistency and naturalness.

[0092] For the corresponding method embodiments described above, see [link to relevant documentation]. Figure 9 The diagram shows a fog effect rendering device in a virtual scene. The device includes:

[0093] The first determining module 901 is used to determine the pre-set visible range of the target object within the fog effect area in response to the target object entering the fog effect area, wherein the visible range is determined based on the influence of the fog effect area on the target object's field of vision.

[0094] The second determining module 902 is used to determine, based on the visible range, a decal component for simulating the target fog effect within the visible range and a mesh model that matches the size of the visible range, wherein the size of the decal component is larger than the size of the mesh model.

[0095] The attachment module 903 is used to attach the decal component and the mesh model to the target object so that the decal component and the mesh model move with the target object within the fog effect area and form a fog effect mask for the virtual scene outside the visible range.

[0096] The rendering module 904 is used to control the rendering and display of the target fog effect determined by the decal component and the virtual scene under the influence of the target fog effect on the target object's terminal device when the target object moves within the fog effect area.

[0097] The fog effect rendering device in the aforementioned virtual scene achieves precise setting of the fog start distance and the distance at which the fog completely obscures the object by attaching a decal component used to simulate the fog effect within the visible range and a mesh model that matches the size of the visible range to the target object. This results in better control over the naturalness of the fog and the visible range, and greatly enhances the fog performance.

[0098] Optionally, the second determining module 902 can also be used for:

[0099] Decal materials for creating virtual scenes;

[0100] Calculate the distance between the coordinates of any pixel within the visible range and the center coordinates of the decal material to obtain the pixel distance;

[0101] The fog effect parameters of the decal material are configured based on the pixel distance to obtain a decal component used to simulate the fog effect of the target within the visible range.

[0102] Optionally, the above-mentioned decal material for creating a virtual scene; calculate the distance between the coordinates of any pixel within the visible range and the center coordinates of the decal material to obtain the pixel distance; configure the fog effect parameters of the decal material based on the pixel distance to obtain a decal component used to simulate the target fog effect within the visible range.

[0103] Optionally, the second determining module 902 can also be used for:

[0104] The pixel distance, the preset fog starting point distance, and the preset fog maximum distance are remapped to obtain the remapped pixel distance, the remapped fog starting point distance, and the remapped fog maximum distance.

[0105] The first calculation result is obtained by calculating the distance between remapped pixels, the distance from the starting point of the fog after remapping, and the distance from the densest fog. The first calculation result is used to control the effect of attenuation softness.

[0106] The first calculation result is output to the opacity node of the decal material to obtain a decal component used to simulate the target fog effect within the visible range; wherein, the target fog effect is a fog effect with a degree of attenuation and softness.

[0107] Optionally, the second determining module 902 can also be used for:

[0108] The pixel distance, the preset fog starting point distance, and the preset fog maximum distance are remapped and calculated to obtain the first calculation result, which is used to control the effect of attenuation softness.

[0109] Create textures that tile the world space;

[0110] A second calculation result is obtained by calculating the texture based on the world space tiling and the first calculation result; the second calculation result is used to control the gradient effect with texture.

[0111] The second calculation result is output to the opacity node of the decal material to obtain a decal component used to simulate the target fog effect within the visible range; wherein, the target fog effect is a fog effect with texture and gradient.

[0112] Optionally, the second determining module 902 can also be used for:

[0113] The second calculation result is output to the opacity node of the decal material, and a fog color parameter is added to obtain a decal component used to simulate the target fog effect within the visible range; wherein, the target fog effect is a fog effect with texture, gradient, and color control.

[0114] Optionally, the second determining module 902 can also be used for:

[0115] The first texture is obtained by calculating based on the first time parameter, the first masking speed, the coordinates of the pixel and the first preset texture map;

[0116] The second texture is obtained by calculating based on the second time parameter, the second masking speed, the coordinates of the pixel, and the second preset texture map.

[0117] The processed first texture and the processed second texture are added together to obtain the target texture;

[0118] The target texture is processed based on preset noise power and preset noise intensity to obtain a world space tiled texture.

[0119] Optionally, the 903 mounting module can also be used for:

[0120] The decal component is attached to the mesh model to form a fog effect mask for the virtual scene outside the visible range, thus occluding the virtual scene outside the visible range; the mesh model is a three-dimensional sphere, and the simulated fog effect concentration is maximized when the size of the decal component reaches the size of the mesh model.

[0121] Attach the mesh model of the decal component to the target object so that the fog mask moves with the target object within the fog area.

[0122] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the fog effect rendering method in the virtual scene described above. This electronic device can be a server or a terminal device.

[0123] See Figure 10 As shown, the electronic device includes a processor 1000 and a memory 1001. The memory 1001 stores machine-executable instructions that can be executed by the processor 1000. The processor 1000 executes the machine-executable instructions to implement the fog effect rendering method in the virtual scene described above.

[0124] Furthermore, Figure 10 The electronic device shown also includes a bus 1002 and a communication interface 1003. The processor 1000, the communication interface 1003 and the memory 1001 are connected via the bus 1002.

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

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

[0127] In response to a target object entering a fog effect area, a pre-set visible range of the target object within the fog effect area is determined, wherein the visible range is determined based on the impact of the fog effect area on the target object's field of vision;

[0128] Based on the visible range, determine the decal component and a mesh model that matches the size of the visible range to simulate the target fog effect within the visible range, wherein the size of the decal component is larger than the size of the mesh model;

[0129] The decal component and mesh model are attached to the target object so that the decal component and mesh model move with the target object within the fog effect area, forming a fog effect mask for the virtual scene outside the visible range.

[0130] When the target object moves within the fog effect area, the system controls the rendering and display of the target fog effect, determined by the decal component, and the virtual scene under the influence of the target fog effect on the target object's terminal device.

[0131] By attaching a decal component used to simulate the fog effect of a target within the visible range and a mesh model that matches the size of the visible range to the target object, the system achieves precise setting of the fog start distance and the distance at which the fog completely obscures the object. This results in better control over the naturalness of the fog and the visible range, significantly enhancing the fog performance.

[0132] The above steps for determining the decal components used to simulate the target fog effect within the visible range, based on the visible range, include:

[0133] Decal materials for creating virtual scenes;

[0134] Calculate the distance between the coordinates of any pixel within the visible range and the center coordinates of the decal material to obtain the pixel distance;

[0135] The fog effect parameters of the decal material are configured based on the pixel distance to obtain a decal component used to simulate the fog effect of the target within the visible range.

[0136] The aforementioned fog effect parameters include the opacity parameter, which is used to simulate that the fog concentration gradually increases according to the distance between the target object and other objects within the visible range, so that the fog concentration is distributed from low to high.

[0137] The steps described above, which configure the fog effect parameters of the decal material based on pixel distance to obtain a decal component for simulating the target fog effect within the visible range, include:

[0138] The pixel distance, the preset fog starting point distance, and the preset fog maximum distance are remapped to obtain the remapped pixel distance, the remapped fog starting point distance, and the remapped fog maximum distance.

[0139] The first calculation result is obtained by calculating the distance between remapped pixels, the distance from the starting point of the fog after remapping, and the distance from the densest fog. The first calculation result is used to control the effect of attenuation softness.

[0140] The first calculation result is output to the opacity node of the decal material to obtain a decal component used to simulate the target fog effect within the visible range; wherein, the target fog effect is a fog effect with a degree of attenuation and softness.

[0141] The steps described above, which configure the fog effect parameters of the decal material based on pixel distance to obtain a decal component for simulating the target fog effect within the visible range, include:

[0142] The pixel distance, the preset fog starting point distance, and the preset fog maximum distance are remapped and calculated to obtain the first calculation result, which is used to control the effect of attenuation softness.

[0143] Create textures that tile the world space;

[0144] A second calculation result is obtained by calculating the texture based on the world space tiling and the first calculation result; the second calculation result is used to control the gradient effect with texture.

[0145] The second calculation result is output to the opacity node of the decal material to obtain a decal component used to simulate the target fog effect within the visible range; wherein, the target fog effect is a textured, gradient fog effect.

[0146] The steps described above, which output the second calculation result to the opacity node of the decal material to obtain the decal component used to simulate the target fog effect within the visible range, include:

[0147] The second calculation result is output to the opacity node of the decal material, and a fog color parameter is added to obtain a decal component used to simulate the target fog effect within the visible range; wherein, the target fog effect is a fog effect with texture, gradient, and color control.

[0148] The steps described above for creating a world-space tiled texture include:

[0149] The first texture is obtained by calculating based on the first time parameter, the first masking speed, the coordinates of the pixel and the first preset texture map;

[0150] The second texture is obtained by calculating based on the second time parameter, the second masking speed, the coordinates of the pixel, and the second preset texture map.

[0151] The processed first texture and the processed second texture are added together to obtain the target texture;

[0152] The target texture is processed based on preset noise power and preset noise intensity to obtain a world space tiled texture.

[0153] The steps described above, which involve attaching the decal component and mesh model to the target object so that the decal component and mesh model move with the target object within the fog effect area and form a fog effect mask for the virtual scene outside the visible range, include:

[0154] The decal component is attached to the mesh model to form a fog effect mask for the virtual scene outside the visible range, thus occluding the virtual scene outside the visible range; the mesh model is a three-dimensional sphere, and the simulated fog effect concentration is maximized when the size of the decal component reaches the size of the mesh model.

[0155] Attach the mesh model of the decal component to the target object so that the fog mask moves with the target object within the fog area.

[0156] This embodiment also provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the following steps of the fog effect rendering method in the above-described virtual scene:

[0157] In response to a target object entering a fog effect area, a pre-set visible range of the target object within the fog effect area is determined, wherein the visible range is determined based on the impact of the fog effect area on the target object's field of vision;

[0158] Based on the visible range, determine the decal component and a mesh model that matches the size of the visible range to simulate the target fog effect within the visible range, wherein the size of the decal component is larger than the size of the mesh model;

[0159] The decal component and mesh model are attached to the target object so that the decal component and mesh model move with the target object within the fog effect area, forming a fog effect mask for the virtual scene outside the visible range.

[0160] When the target object moves within the fog effect area, the system controls the rendering and display of the target fog effect, determined by the decal component, and the virtual scene under the influence of the target fog effect on the target object's terminal device.

[0161] By attaching a decal component used to simulate the fog effect of a target within the visible range and a mesh model that matches the size of the visible range to the target object, the system achieves precise setting of the fog start distance and the distance at which the fog completely obscures the object. This results in better control over the naturalness of the fog and the visible range, significantly enhancing the fog performance.

[0162] The above steps for determining the decal components used to simulate the target fog effect within the visible range, based on the visible range, include:

[0163] Decal materials for creating virtual scenes;

[0164] Calculate the distance between the coordinates of any pixel within the visible range and the center coordinates of the decal material to obtain the pixel distance;

[0165] The fog effect parameters of the decal material are configured based on the pixel distance to obtain a decal component used to simulate the fog effect of the target within the visible range.

[0166] The aforementioned fog effect parameters include the opacity parameter, which is used to simulate that the fog concentration gradually increases according to the distance between the target object and other objects within the visible range, so that the fog concentration is distributed from low to high.

[0167] The steps described above, which configure the fog effect parameters of the decal material based on pixel distance to obtain a decal component for simulating the target fog effect within the visible range, include:

[0168] The pixel distance, the preset fog starting point distance, and the preset fog maximum distance are remapped to obtain the remapped pixel distance, the remapped fog starting point distance, and the remapped fog maximum distance.

[0169] The first calculation result is obtained by calculating the distance between remapped pixels, the distance from the starting point of the fog after remapping, and the distance from the densest fog. The first calculation result is used to control the effect of attenuation softness.

[0170] The first calculation result is output to the opacity node of the decal material to obtain a decal component used to simulate the target fog effect within the visible range; wherein, the target fog effect is a fog effect with a degree of attenuation and softness.

[0171] The steps described above, which configure the fog effect parameters of the decal material based on pixel distance to obtain a decal component for simulating the target fog effect within the visible range, include:

[0172] The pixel distance, the preset fog starting point distance, and the preset fog maximum distance are remapped and calculated to obtain the first calculation result, which is used to control the effect of attenuation softness.

[0173] Create textures that tile the world space;

[0174] A second calculation result is obtained by calculating the texture based on the world space tiling and the first calculation result; the second calculation result is used to control the gradient effect with texture.

[0175] The second calculation result is output to the opacity node of the decal material to obtain a decal component used to simulate the target fog effect within the visible range; wherein, the target fog effect is a textured, gradient fog effect.

[0176] The steps described above, which output the second calculation result to the opacity node of the decal material to obtain the decal component used to simulate the target fog effect within the visible range, include:

[0177] The second calculation result is output to the opacity node of the decal material, and a fog color parameter is added to obtain a decal component used to simulate the target fog effect within the visible range; wherein, the target fog effect is a fog effect with texture, gradient, and color control.

[0178] The steps described above for creating a world-space tiled texture include:

[0179] The first texture is obtained by calculating based on the first time parameter, the first masking speed, the coordinates of the pixel and the first preset texture map;

[0180] The second texture is obtained by calculating based on the second time parameter, the second masking speed, the coordinates of the pixel, and the second preset texture map.

[0181] The processed first texture and the processed second texture are added together to obtain the target texture;

[0182] The target texture is processed based on preset noise power and preset noise intensity to obtain a world space tiled texture.

[0183] The steps described above, which involve attaching the decal component and mesh model to the target object so that the decal component and mesh model move with the target object within the fog effect area and form a fog effect mask for the virtual scene outside the visible range, include:

[0184] The decal component is attached to the mesh model to form a fog effect mask for the virtual scene outside the visible range, thus occluding the virtual scene outside the visible range; the mesh model is a three-dimensional sphere, and the simulated fog effect concentration is maximized when the size of the decal component reaches the size of the mesh model.

[0185] Attach the mesh model of the decal component to the target object so that the fog mask moves with the target object within the fog area.

[0186] The computer program product of the fog effect rendering method, device, electronic device and storage medium in the virtual scene provided in this embodiment includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

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

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

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

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

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

Claims

1. A method for rendering fog effects in a virtual scene, characterized in that, The virtual scene includes a fog effect area, and the method includes: In response to a target object entering the fog effect area, a pre-set visible range of the target object within the fog effect area is determined, wherein the visible range is determined based on the influence of the fog effect area on the field of vision of the target object; Based on the visible range, a decal component for simulating a target fog effect within the visible range and a mesh model matching the size of the visible range are determined, wherein the size of the decal component is larger than the size of the mesh model; The decal component and the mesh model are attached to the target object so that the decal component and the mesh model move with the target object within the fog effect area, forming a fog effect mask for the virtual scene outside the visible range; When the target object moves within the fog effect area, the system controls the rendering and display of the target fog effect determined based on the decal component, as well as the virtual scene under the influence of the target fog effect, on the target object's terminal device.

2. The method according to claim 1, characterized in that, The step of determining the decal component for simulating a target fog effect within the visible range, based on the visible range, includes: Create decal materials for the virtual scene; Calculate the distance between the coordinates of any pixel within the visible range and the center coordinates of the decal material to obtain the pixel distance; The fog effect parameters of the decal material are configured based on the pixel distance to obtain a decal component for simulating the target fog effect within the visible range.

3. The method according to claim 2, characterized in that, The fog effect parameters include an opacity parameter, which is used to simulate that the fog concentration gradually increases according to the distance between the target object and other objects within the visible range, so that the fog concentration is distributed from low to high.

4. The method according to claim 2, characterized in that, The step of configuring the fog effect parameters of the decal material based on the pixel distance to obtain a decal component for simulating the target fog effect within the visible range includes: The pixel distance, the preset fog starting point distance, and the preset fog maximum distance are remapped to obtain the remapped pixel distance, the remapped fog starting point distance, and the remapped fog maximum distance. Based on the remapped pixel distance, the remapped fog starting point distance, and the fog maximum density distance, a first calculation result is obtained, wherein the first calculation result is used to control the effect of attenuation softness. The first calculation result is output to the opacity node of the decal material to obtain a decal component for simulating a target fog effect within the visible range; wherein the target fog effect is a fog effect with a degree of attenuation and softness.

5. The method according to claim 2, characterized in that, The step of configuring the fog effect parameters of the decal material based on the pixel distance to obtain a decal component for simulating the target fog effect within the visible range includes: The pixel distance, the preset fog starting point distance, and the preset fog maximum distance are remapped and calculated to obtain a first calculation result, wherein the first calculation result is used to control the effect of attenuation softness. Create textures that tile the world space; A second calculation result is obtained by calculating the texture of the world space tiling and the first calculation result; wherein, the second calculation result is used to control the gradient effect with texture; The second calculation result is output to the opacity node of the decal material to obtain a decal component for simulating the target fog effect within the visible range; wherein the target fog effect is a textured, gradient fog effect.

6. The method according to claim 5, characterized in that, The step of outputting the second calculation result to the opacity node of the decal material to obtain the decal component used to simulate the target fog effect within the visible range includes: The second calculation result is output to the opacity node of the decal material, and a fog color parameter is added to obtain a decal component for simulating the target fog effect within the visible range; wherein, the target fog effect is a fog effect with texture, gradient, and color control.

7. The method according to claim 5, characterized in that, The steps for creating a world-space tiled texture include: The first texture is obtained by calculating based on the first time parameter, the first masking speed, the coordinates of the pixel and the first preset texture map; The second texture is obtained by calculating based on the second time parameter, the second masking speed, the coordinates of the pixel, and the second preset texture map; The processed first texture and the processed second texture are added together to obtain the target texture; The target texture is processed based on preset noise power and preset noise intensity to obtain a world space tiled texture.

8. The method according to claim 1, characterized in that, The step of attaching the decal component and the mesh model to the target object, so that the decal component and the mesh model move with the target object within the fog effect area, and forming a fog effect mask for the virtual scene outside the visible range, includes: The decal component is attached to the mesh model to form a fog effect mask for the virtual scene outside the visible range, so that the virtual scene outside the visible range is occluded; wherein, the mesh model is a three-dimensional sphere, and the fog effect concentration is maximized when the size of the decal component reaches the size of the mesh model; The mesh model to which the decal component is attached is attached to the target object so that the fog effect mask moves with the target object within the fog effect area.

9. A fog effect rendering device for a virtual scene, characterized in that, The virtual scene includes a fog effect area, and the fog effect rendering device for the virtual scene includes: The first determining module is used to determine the pre-set visible range of the target object within the fog effect area in response to the target object entering the fog effect area, wherein the visible range is determined based on the influence of the fog effect area on the field of vision of the target object; The second determining module is used to determine, based on the visible range, a decal component for simulating a target fog effect within the visible range and a mesh model matching the size of the visible range, wherein the size of the decal component is larger than the size of the mesh model; The attachment module is used to attach the decal component and the mesh model to the target object, so that the decal component and the mesh model move with the target object within the fog effect area, and form a fog effect mask for the virtual scene outside the visible range; The rendering module is used to control the rendering and display of the target fog effect determined based on the decal component, and the virtual scene under the influence of the target fog effect, on the target object's terminal device when the target object moves within the fog effect area.

10. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the fog effect rendering method in the virtual scene according to any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the fog rendering method in the virtual scene according to any one of claims 1-8.