Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/shaders/material/gpu_shader_material_glossy.glsl
| #ifndef VOLUMETRICS | #ifndef VOLUMETRICS | ||||
| CLOSURE_EVAL_FUNCTION_DECLARE_1(node_bsdf_glossy, Glossy) | |||||
| void node_bsdf_glossy( | void node_bsdf_glossy( | ||||
| vec4 color, float roughness, vec3 N, float use_multiscatter, float ssr_id, out Closure result) | vec4 color, float roughness, vec3 N, float use_multiscatter, float ssr_id, out Closure result) | ||||
| { | { | ||||
| N = normalize(N); | bool do_ssr = (ssrToggle && int(ssr_id) == outputSsrId); | ||||
| vec3 out_spec, ssr_spec; | |||||
| eevee_closure_glossy(N, | CLOSURE_VARS_DECLARE_1(Glossy); | ||||
| vec3(1.0), | |||||
| use_multiscatter != 0.0 ? vec3(1.0) : vec3(-1.0), /* HACK */ | in_Glossy_0.N = N; /* Normalized during eval. */ | ||||
| int(ssr_id), | in_Glossy_0.roughness = roughness; | ||||
| roughness, | |||||
| 1.0, | CLOSURE_EVAL_FUNCTION_1(node_bsdf_glossy, Glossy); | ||||
| true, | |||||
| out_spec, | |||||
| ssr_spec); | |||||
| vec3 vN = mat3(ViewMatrix) * N; | |||||
| result = CLOSURE_DEFAULT; | result = CLOSURE_DEFAULT; | ||||
| result.radiance = render_pass_glossy_mask(vec3(1.0), out_spec) * color.rgb; | |||||
| closure_load_ssr_data(ssr_spec * color.rgb, roughness, N, viewCameraVec, int(ssr_id), result); | vec2 split_sum = brdf_lut(dot(in_Glossy_0.N, cameraVec), in_Glossy_0.roughness); | ||||
| vec3 brdf = (use_multiscatter != 0.0) ? F_brdf_multi_scatter(vec3(1.0), vec3(1.0), split_sum) : | |||||
| F_brdf_single_scatter(vec3(1.0), vec3(1.0), split_sum); | |||||
| out_Glossy_0.radiance = closure_mask_ssr_radiance(out_Glossy_0.radiance, ssr_id); | |||||
| out_Glossy_0.radiance *= brdf; | |||||
| out_Glossy_0.radiance = render_pass_glossy_mask(vec3(1.0), out_Glossy_0.radiance); | |||||
| out_Glossy_0.radiance *= color.rgb; | |||||
| closure_load_ssr_data( | |||||
| out_Glossy_0.radiance, in_Glossy_0.roughness, in_Glossy_0.N, ssr_id, result); | |||||
| } | } | ||||
| #else | #else | ||||
| /* Stub glossy because it is not compatible with volumetrics. */ | /* Stub glossy because it is not compatible with volumetrics. */ | ||||
| # define node_bsdf_glossy(a, b, c, d, e, result) (result = CLOSURE_DEFAULT) | # define node_bsdf_glossy(a, b, c, d, e, result) (result = CLOSURE_DEFAULT) | ||||
| #endif | #endif | ||||