Differential D16826 Diff 59819 source/blender/draw/engines/workbench/shaders/workbench_composite_frag.glsl
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/workbench/shaders/workbench_composite_frag.glsl
| Show All 10 Lines | void main() | ||||
| vec3 N = workbench_normal_decode(texture(normalBuffer, uvcoordsvar.st)); | vec3 N = workbench_normal_decode(texture(normalBuffer, uvcoordsvar.st)); | ||||
| vec4 mat_data = texture(materialBuffer, uvcoordsvar.st); | vec4 mat_data = texture(materialBuffer, uvcoordsvar.st); | ||||
| vec3 base_color = mat_data.rgb; | vec3 base_color = mat_data.rgb; | ||||
| float roughness, metallic; | float roughness, metallic; | ||||
| workbench_float_pair_decode(mat_data.a, roughness, metallic); | workbench_float_pair_decode(mat_data.a, roughness, metallic); | ||||
| #ifdef V3D_LIGHTING_MATCAP | #ifdef WORKBENCH_LIGHTING_MATCAP | ||||
| /* When using matcaps, mat_data.a is the back-face sign. */ | /* When using matcaps, mat_data.a is the back-face sign. */ | ||||
| N = (mat_data.a > 0.0) ? N : -N; | N = (mat_data.a > 0.0) ? N : -N; | ||||
| fragColor.rgb = get_matcap_lighting(matcap_diffuse_tx, matcap_specular_tx, base_color, N, I); | fragColor.rgb = get_matcap_lighting(matcap_diffuse_tx, matcap_specular_tx, base_color, N, I); | ||||
| #endif | #endif | ||||
| #ifdef V3D_LIGHTING_STUDIO | #ifdef WORKBENCH_LIGHTING_STUDIO | ||||
| fragColor.rgb = get_world_lighting(base_color, roughness, metallic, N, I); | fragColor.rgb = get_world_lighting(base_color, roughness, metallic, N, I); | ||||
| #endif | #endif | ||||
| #ifdef V3D_LIGHTING_FLAT | #ifdef WORKBENCH_LIGHTING_FLAT | ||||
| fragColor.rgb = base_color; | fragColor.rgb = base_color; | ||||
| #endif | #endif | ||||
| fragColor.rgb *= get_shadow(N, forceShadowing); | fragColor.rgb *= get_shadow(N, forceShadowing); | ||||
| fragColor.a = 1.0; | fragColor.a = 1.0; | ||||
| } | } | ||||