Volumetric realtime fog of war
A method of forming a volumetric effect on a game map of a video game is provided. In the method, a variable density volume of the game map is determined based on a mesh of the game map and a bounding box. The variable density volume includes the volumetric effect. The variable density volume is sliced into a plurality of texture layers. Each of the plurality of texture layers includes information associated with at least one of the volumetric effect or the mesh. An interaction between a virtual object on the game map and the volumetric effect is determined based on movement of the virtual object. The volumetric effect is rendered based on a cut out of the virtual object in the variable density volume and the determined interaction.
1 . A method of forming a volumetric effect on a game map of a video game, the method comprising:
determining a variable density volume corresponding to a three-dimensional (3D) mesh of the game map and a 3D bounding box that encloses the 3D mesh, the variable density volume including the volumetric effect;
slicing the variable density volume into a plurality of texture layers, each of the plurality of texture layers (i) including information associated with at least one of the volumetric effect or the 3D mesh and (ii) being parallel to a cross-sectional plane of the 3D bounding box;
determining an interaction between a virtual object on the game map and the volumetric effect based on (i) a signed distance field (SDF) of a geometric region of the 3D mesh in each of the plurality of texture layers and (ii) a boundary region of the virtual object; and
rendering the volumetric effect based on a cut out of the virtual object in the variable density volume and the determined interaction.
2 . The method of claim 1 , wherein the determining the variable density volume further comprises:
generating a source mesh in the game map, the source mesh including at least one environment element in the game map; and
reducing edges and vertices of the source mesh to generate the 3D mesh.
3 . The method of claim 1 , wherein the volumetric effect includes one of a cloud layer, a fog layer, a dust storm, and a rainfall.
4 . The method of claim 1 , wherein the interaction includes at least one of a twist speed, a wind direction, a gradient falloff, a push/pull parameter, or a repel strength.
5 . The method of claim 1 , wherein the determining the interaction further comprises:
determining the SDF of the geometric region of the 3D mesh that is to be skipped for processing in each of the plurality of texture layers;
cutting out the virtual object from the plurality of texture layers to determine the boundary region of the virtual object; and
determining the interaction between the boundary region of the virtual object and the volumetric effect.
6 . The method of claim 1 , wherein the rendering further comprises:
removing a top region of the variable density volume to determine a base height texture.
7 . The method of claim 6 , wherein the rendering further comprises:
adding a 3D noise texture to the base height texture in the variable density volume, the added 3D noise texture having a relative movement with respect to the base height texture.
8 . The method of claim 6 , wherein the rendering further comprises:
adding additional movement information to the volumetric effect in the 3D bounding box based on a flow map.
9 . The method of claim 6 , wherein at least one of an opacity or a color gradient of the volumetric effect varies along a height of the variable density volume.
10 . The method of claim 1 , wherein the rendering further comprises:
generating a sheen associated with the volumetric effect by adjusting volumetric falloff parameters of a surface shader, the volumetric falloff parameters indicating how light bounces off the volumetric effect.
11 . The method of claim 1 , wherein the rendering further comprises:
generating scene lighting based on a ray cast of light inside the volumetric effect.
12 . The method of claim 1 , wherein the rendering further comprises one of:
rendering the volumetric effect at a reduced resolution with respect to a resolution of a game display of the video game; and
rendering pixels of the volumetric effect positioned in a checkerboard grid pattern.
13 . The method of claim 12 , wherein the rendering further comprises:
performing a post blurring process to the volumetric effect to reduce aliasing of the volumetric effect.
14 . An apparatus, the apparatus comprising:
processing circuitry configured to:
determine a variable density volume corresponding to a three-dimensional (3D) mesh of a game map and a 3D bounding box that encloses the 3D mesh, the variable density volume including a volumetric effect;
slice the variable density volume into a plurality of texture layers, each of the plurality of texture layers (i) including information associated with at least one of the volumetric effect or the 3D mesh and (ii) being parallel to a cross-sectional plane of the 3D bounding box;
determine an interaction between a virtual object on the game map and the volumetric effect based on (i) a signed distance field (SDF) of a geometric region of the 3D mesh in each of the plurality of texture layers and (ii) a boundary region of the virtual object; and
render the volumetric effect based on a cut out of the virtual object in the variable density volume and the determined interaction.
15 . The apparatus of claim 14 , wherein the processing circuitry is configured to:
generate a source mesh in the game map, the source mesh including at least one environment element in the game map; and
reduce edges and vertices of the source mesh to generate the 3D mesh.
16 . The apparatus of claim 14 , wherein the volumetric effect includes one of a cloud layer, a fog layer, a dust storm, and a rainfall.
17 . The apparatus of claim 14 , wherein the interaction includes at least one of a twist speed, a wind direction, a gradient falloff, a push/pull parameter, or a repel strength.
18 . The apparatus of claim 14 , wherein the processing circuitry is configured to:
determine the SDF of the geometric region of the 3D mesh that is to be skipped for processing in each of the plurality of texture layers;
cut out the virtual object from the plurality of texture layers to determine the boundary region of the virtual object; and
determine the interaction between the boundary region of the virtual object and the volumetric effect.
19 . A non-transitory computer readable storage medium storing instructions which when executed by at least one processor cause the at least one processor to perform:
determining a variable density volume corresponding to a three-dimensional (3D) mesh of a game map and a 3D bounding box that encloses the 3D mesh, the variable density volume including a volumetric effect;
slicing the variable density volume into a plurality of texture layers, each of the plurality of texture layers including (i) information associated with at least one of the volumetric effect or the 3D mesh and (ii) being parallel to a cross-sectional plane of the 3D bounding box;
determining an interaction between a virtual object on the game map and the volumetric effect based on (i) a signed distance field (SDF) of a geometric region of the 3D mesh in each of the plurality of texture layers and (ii) a boundary region of the virtual object; and
rendering the volumetric effect based on a cut out of the virtual object in the variable density volume and the determined interaction.