Differential D17089 Diff 60052 source/blender/draw/engines/eevee/shaders/lightprobe_filter_diffuse_frag.glsl
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/shaders/lightprobe_filter_diffuse_frag.glsl
| #pragma BLENDER_REQUIRE(random_lib.glsl) | #pragma BLENDER_REQUIRE(random_lib.glsl) | ||||
| #pragma BLENDER_REQUIRE(bsdf_sampling_lib.glsl) | #pragma BLENDER_REQUIRE(bsdf_sampling_lib.glsl) | ||||
| #pragma BLENDER_REQUIRE(common_math_geom_lib.glsl) | #pragma BLENDER_REQUIRE(common_math_geom_lib.glsl) | ||||
| #pragma BLENDER_REQUIRE(irradiance_lib.glsl) | #pragma BLENDER_REQUIRE(irradiance_lib.glsl) | ||||
| #define M_4PI 12.5663706143591729 | #define M_4PI 12.5663706143591729 | ||||
| vec3 get_cubemap_vector(vec2 co, int face) | |||||
| { | |||||
| /* NOTE(Metal): Declaring constant array in function scope to avoid increasing local shader | |||||
| * memory pressure. */ | |||||
| const mat3 CUBE_ROTATIONS[6] = mat3[]( | const mat3 CUBE_ROTATIONS[6] = mat3[]( | ||||
| mat3(vec3(0.0, 0.0, -1.0), vec3(0.0, -1.0, 0.0), vec3(-1.0, 0.0, 0.0)), | mat3(vec3(0.0, 0.0, -1.0), vec3(0.0, -1.0, 0.0), vec3(-1.0, 0.0, 0.0)), | ||||
| mat3(vec3(0.0, 0.0, 1.0), vec3(0.0, -1.0, 0.0), vec3(1.0, 0.0, 0.0)), | mat3(vec3(0.0, 0.0, 1.0), vec3(0.0, -1.0, 0.0), vec3(1.0, 0.0, 0.0)), | ||||
| mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, -1.0, 0.0)), | mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, -1.0, 0.0)), | ||||
| mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 0.0, -1.0), vec3(0.0, 1.0, 0.0)), | mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 0.0, -1.0), vec3(0.0, 1.0, 0.0)), | ||||
| mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0), vec3(0.0, 0.0, -1.0)), | mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0), vec3(0.0, 0.0, -1.0)), | ||||
| mat3(vec3(-1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0), vec3(0.0, 0.0, 1.0))); | mat3(vec3(-1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0), vec3(0.0, 0.0, 1.0))); | ||||
| vec3 get_cubemap_vector(vec2 co, int face) | |||||
| { | |||||
| return normalize(CUBE_ROTATIONS[face] * vec3(co * 2.0 - 1.0, 1.0)); | return normalize(CUBE_ROTATIONS[face] * vec3(co * 2.0 - 1.0, 1.0)); | ||||
| } | } | ||||
| float area_element(float x, float y) | float area_element(float x, float y) | ||||
| { | { | ||||
| return atan(x * y, sqrt(x * x + y * y + 1)); | return atan(x * y, sqrt(x * x + y * y + 1)); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines | |||||