Differential D13910 Diff 47394 source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
| #pragma BLENDER_REQUIRE(workbench_data_lib.glsl) | |||||
| /* [Drobot2014a] Low Level Optimizations for GCN */ | /* [Drobot2014a] Low Level Optimizations for GCN */ | ||||
| vec4 fast_rcp(vec4 v) | vec4 fast_rcp(vec4 v) | ||||
| { | { | ||||
| return intBitsToFloat(0x7eef370b - floatBitsToInt(v)); | return intBitsToFloat(0x7eef370b - floatBitsToInt(v)); | ||||
| } | } | ||||
| vec3 brdf_approx(vec3 spec_color, float roughness, float NV) | vec3 brdf_approx(vec3 spec_color, float roughness, float NV) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | vec3 get_world_lighting(vec3 base_color, float roughness, float metallic, vec3 N, vec3 I) | ||||
| * Limit this strangeness by using mono-chromatic specular intensity. */ | * Limit this strangeness by using mono-chromatic specular intensity. */ | ||||
| float spec_energy = dot(specular_color, vec3(0.33333)); | float spec_energy = dot(specular_color, vec3(0.33333)); | ||||
| diffuse_light *= diffuse_color * (1.0 - spec_energy); | diffuse_light *= diffuse_color * (1.0 - spec_energy); | ||||
| return diffuse_light + specular_light; | return diffuse_light + specular_light; | ||||
| } | } | ||||
| uniform bool forceShadowing = false; | float get_shadow(vec3 N, bool force_shadowing) | ||||
| float get_shadow(vec3 N) | |||||
| { | { | ||||
| float light_factor = -dot(N, world_data.shadow_direction_vs.xyz); | float light_factor = -dot(N, world_data.shadow_direction_vs.xyz); | ||||
| float shadow_mix = smoothstep(world_data.shadow_shift, world_data.shadow_focus, light_factor); | float shadow_mix = smoothstep(world_data.shadow_shift, world_data.shadow_focus, light_factor); | ||||
| shadow_mix *= forceShadowing ? 0.0 : world_data.shadow_mul; | shadow_mix *= force_shadowing ? 0.0 : world_data.shadow_mul; | ||||
| return shadow_mix + world_data.shadow_add; | return shadow_mix + world_data.shadow_add; | ||||
| } | } | ||||