Differential D9010 Diff 29259 source/blender/gpu/shaders/material/gpu_shader_material_shader_to_rgba.glsl
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/shaders/material/gpu_shader_material_shader_to_rgba.glsl
| #ifndef VOLUMETRICS | #ifndef VOLUMETRICS | ||||
| void node_shader_to_rgba(Closure cl, out vec4 outcol, out float outalpha) | void node_shader_to_rgba(Closure cl, out vec4 outcol, out float outalpha) | ||||
| { | { | ||||
| vec4 spec_accum = vec4(0.0); | vec4 spec_accum = vec4(0.0); | ||||
| if (ssrToggle && FLAG_TEST(cl.flag, CLOSURE_SSR_FLAG)) { | if (ssrToggle && FLAG_TEST(cl.flag, CLOSURE_SSR_FLAG)) { | ||||
| vec3 V = cameraVec; | vec3 V = cameraVec; | ||||
| vec3 vN = normal_decode(cl.ssr_normal, viewCameraVec); | vec3 vN = normal_decode(cl.ssr_normal, viewCameraVec); | ||||
| vec3 N = transform_direction(ViewMatrixInverse, vN); | vec3 N = transform_direction(ViewMatrixInverse, vN); | ||||
| float roughness = cl.ssr_data.a; | float roughness = cl.ssr_data.a; | ||||
| float roughnessSquared = max(1e-3, roughness * roughness); | float roughnessSquared = max(1e-3, roughness * roughness); | ||||
| fallback_cubemap(N, V, worldPosition, viewPosition, roughness, roughnessSquared, spec_accum); | fallback_cubemap(N, V, worldPosition, viewPosition, roughness, roughnessSquared, spec_accum); | ||||
| } | } | ||||
| outalpha = avg(cl.transmittance); | outalpha = clamp(1.0 - avg(cl.transmittance), 0.0, 1.0); | ||||
| outcol = vec4((spec_accum.rgb * cl.ssr_data.rgb) + cl.radiance, 1.0); | outcol = vec4((spec_accum.rgb * cl.ssr_data.rgb) + cl.radiance, 1.0); | ||||
| # ifdef USE_SSS | # ifdef USE_SSS | ||||
| outcol.rgb += cl.sss_irradiance.rgb * cl.sss_albedo; | outcol.rgb += cl.sss_irradiance.rgb * cl.sss_albedo; | ||||
| # endif | # endif | ||||
| } | } | ||||
| #endif /* VOLUMETRICS */ | #endif /* VOLUMETRICS */ | ||||