EEVEE-Next: Remove sampling_lib from ray_generate_lib

Avoid top level dependency.
This commit is contained in:
Clément Foucault
2024-01-10 21:38:24 +13:00
parent b24591baed
commit 93b3553697
2 changed files with 6 additions and 7 deletions

View File

@@ -34,6 +34,7 @@ void main()
vec3 P = drw_point_screen_to_world(vec3(uv, 0.5));
vec3 V = drw_world_incident_vector(P);
vec2 noise = utility_tx_fetch(utility_tx, vec2(texel), UTIL_BLUE_NOISE_LAYER).rg;
noise = fract(noise + sampling_rng_2D_get(SAMPLING_RAYTRACE_U));
BsdfSample samp = ray_generate_direction(noise.xy, gbuffer_closure_get(gbuf, closure_index), V);

View File

@@ -6,13 +6,12 @@
* Ray generation routines for each BSDF types.
*/
#pragma BLENDER_REQUIRE(gpu_shader_utildefines_lib.glsl)
#pragma BLENDER_REQUIRE(gpu_shader_math_vector_lib.glsl)
#pragma BLENDER_REQUIRE(eevee_bxdf_sampling_lib.glsl)
#pragma BLENDER_REQUIRE(eevee_ray_types_lib.glsl)
#pragma BLENDER_REQUIRE(eevee_sampling_lib.glsl)
#pragma BLENDER_REQUIRE(gpu_shader_codegen_lib.glsl)
#pragma BLENDER_REQUIRE(gpu_shader_math_matrix_lib.glsl)
#pragma BLENDER_REQUIRE(gpu_shader_math_vector_lib.glsl)
#pragma BLENDER_REQUIRE(gpu_shader_utildefines_lib.glsl)
#pragma BLENDER_REQUIRE(eevee_bxdf_sampling_lib.glsl)
#pragma BLENDER_REQUIRE(eevee_ray_types_lib.glsl)
struct BsdfSample {
vec3 direction;
@@ -30,8 +29,7 @@ bool is_singular_ray(float roughness)
/* Returns view-space ray. */
BsdfSample ray_generate_direction(vec2 noise, ClosureUndetermined cl, vec3 V)
{
vec2 noise_offset = sampling_rng_2D_get(SAMPLING_RAYTRACE_U);
vec3 random_point_on_cylinder = sample_cylinder(fract(noise_offset + noise));
vec3 random_point_on_cylinder = sample_cylinder(noise);
/* Bias the rays so we never get really high energy rays almost parallel to the surface. */
random_point_on_cylinder.x = random_point_on_cylinder.x * (1.0 - RAY_BIAS) + RAY_BIAS;