This patch adds new render passes to EEVEE. These passes include: * Emission * Diffuse Light * Diffuse Color * Glossy Light * Glossy Color * Environment * Volume Scattering * Volume Transmission * Bloom * Shadow With these passes it will be possible to use EEVEE effectively for compositing. During development we kept a close eye on how to get similar results compared to cycles render passes there are some differences that are related to how EEVEE works. For EEVEE we combined the passes to `Diffuse` and `Specular`. There are no transmittance or sss passes anymore. Cycles will be changed accordingly. Cycles volume transmittance is added to multiple surface col passes. For EEVEE we left the volume transmittance as a separate pass. Known Limitations * All materials that use alpha blending will not be rendered in the render passes. Other transparency modes are supported. * More GPU memory is required to store the render passes. When rendering a HD image with all render passes enabled at max extra 570MB GPU memory is required. Implementation Details An overview of render passes have been described in https://wiki.blender.org/wiki/Source/Render/EEVEE/RenderPasses Future Developments * In this implementation the materials are re-rendered for Diffuse/Glossy and Emission passes. We could use multi target rendering to improve the render speed. * Other passes can be added later * Don't render material based passes when only requesting AO or Shadow. * Add more passes to the system. These could include Cryptomatte, AOV's, Vector, ObjectID, MaterialID, UV. Reviewed By: Clément Foucault Differential Revision: https://developer.blender.org/D6331
52 lines
1.5 KiB
GLSL
52 lines
1.5 KiB
GLSL
|
|
uniform vec3 basecol;
|
|
uniform float metallic;
|
|
uniform float specular;
|
|
uniform float roughness;
|
|
|
|
Closure nodetree_exec(void)
|
|
{
|
|
#ifdef HAIR_SHADER
|
|
vec3 B = normalize(cross(worldNormal, hairTangent));
|
|
float cos_theta;
|
|
if (hairThicknessRes == 1) {
|
|
vec4 rand = texelFetch(utilTex, ivec3(ivec2(gl_FragCoord.xy) % LUT_SIZE, 2.0), 0);
|
|
/* Random cosine normal distribution on the hair surface. */
|
|
cos_theta = rand.x * 2.0 - 1.0;
|
|
}
|
|
else {
|
|
/* Shade as a cylinder. */
|
|
cos_theta = hairThickTime / hairThickness;
|
|
}
|
|
float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
|
|
vec3 N = normalize(worldNormal * sin_theta + B * cos_theta);
|
|
vec3 vN = mat3(ViewMatrix) * N;
|
|
#else
|
|
vec3 N = normalize(gl_FrontFacing ? worldNormal : -worldNormal);
|
|
vec3 vN = normalize(gl_FrontFacing ? viewNormal : -viewNormal);
|
|
#endif
|
|
|
|
vec3 dielectric = vec3(0.034) * specular * 2.0;
|
|
vec3 albedo = mix(basecol, vec3(0.0), metallic);
|
|
vec3 f0 = mix(dielectric, basecol, metallic);
|
|
vec3 f90 = mix(vec3(1.0), f0, (1.0 - specular) * metallic);
|
|
vec3 out_diff, out_spec, ssr_spec;
|
|
eevee_closure_default(N, albedo, f0, f90, 1, roughness, 1.0, true, out_diff, out_spec, ssr_spec);
|
|
|
|
Closure cl = CLOSURE_DEFAULT;
|
|
cl.radiance = render_pass_glossy_mask(vec3(1.0), out_spec) +
|
|
render_pass_diffuse_mask(albedo, out_diff * albedo);
|
|
closure_load_ssr_data(ssr_spec, roughness, N, viewCameraVec, 1, cl);
|
|
|
|
#ifdef LOOKDEV
|
|
gl_FragDepth = 0.0;
|
|
#endif
|
|
|
|
#ifdef HOLDOUT
|
|
cl = CLOSURE_DEFAULT;
|
|
cl.holdout = 1.0;
|
|
#endif
|
|
|
|
return cl;
|
|
}
|