Required by Metal backend for efficient shader compilation. EEVEE material resource binding permutations now controlled via CreateInfo and selected based on material options. Other existing CreateInfo's also modified to ensure explicitness for depth-writing mode. Other missing bindings also addressed to ensure full compliance with the Metal backend. Authored by Apple: Michael Parkin-White Ref T96261 Reviewed By: fclem Differential Revision: https://developer.blender.org/D16243
24 lines
747 B
GLSL
24 lines
747 B
GLSL
|
|
#pragma BLENDER_REQUIRE(volumetric_lib.glsl)
|
|
|
|
/* 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. */
|
|
|
|
void main()
|
|
{
|
|
vec2 uvs = gl_FragCoord.xy / vec2(textureSize(inSceneDepth, 0));
|
|
float scene_depth = texture(inSceneDepth, uvs).r;
|
|
|
|
vec3 transmittance, scattering;
|
|
volumetric_resolve(uvs, scene_depth, transmittance, scattering);
|
|
|
|
/* Approximate volume alpha by using a monochromatic transmittance
|
|
* and adding it to the scene alpha. */
|
|
float alpha = dot(transmittance, vec3(1.0 / 3.0));
|
|
|
|
FragColor0 = vec4(scattering, 1.0 - alpha);
|
|
FragColor1 = vec4(transmittance, alpha);
|
|
}
|