blob: 0115b2cb99eee9b2741c4387b3a8cb25d31b6e75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/* Based on Frosbite Unified Volumetric.
* https://www.ea.com/frostbite/news/physically-based-unified-volumetric-rendering-in-frostbite */
/* Step 4 : Apply final integration on top of the scene color.
* Note that we do the blending ourself instead of relying
* on hardware blending which would require 2 pass. */
uniform sampler2D inSceneColor;
uniform sampler2D inSceneDepth;
out vec4 FragColor;
void main()
{
vec2 uvs = gl_FragCoord.xy / vec2(textureSize(inSceneDepth, 0));
vec4 scene_color = texture(inSceneColor, uvs);
float scene_depth = texture(inSceneDepth, uvs).r;
FragColor = volumetric_resolve(scene_color, uvs, scene_depth);
}
|