mirror of
https://github.com/godotengine/godot.git
synced 2024-12-15 10:12:40 +08:00
Merge pull request #100344 from clayjohn/refprobe-blend
Small fixups for the new reflection probe blending
This commit is contained in:
commit
691d8bee2b
@ -1619,21 +1619,15 @@ void reflection_process(samplerCube reflection_map,
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 inner_pos = abs(local_pos / box_extents);
|
||||
vec3 blend_axes = vec3(0.0, 0.0, 0.0);
|
||||
float blend = 0.0;
|
||||
if (blend_distance != 0) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
float axis_blend_distance = min(blend_distance, box_extents[i]);
|
||||
blend_axes[i] = (inner_pos[i] * box_extents[i]) - box_extents[i] + axis_blend_distance;
|
||||
blend_axes[i] = blend_axes[i] / axis_blend_distance;
|
||||
blend_axes[i] = clamp(blend_axes[i], 0.0, 1.0);
|
||||
}
|
||||
blend = pow((1.0 - blend_axes.x) * (1.0 - blend_axes.y) * (1.0 - blend_axes.z), 2);
|
||||
blend = 1 - blend;
|
||||
float blend = 1.0;
|
||||
if (blend_distance != 0.0) {
|
||||
vec3 axis_blend_distance = min(vec3(blend_distance), box_extents);
|
||||
vec3 blend_axes = abs(local_pos) - box_extents + axis_blend_distance;
|
||||
blend_axes /= axis_blend_distance;
|
||||
blend_axes = clamp(1.0 - blend_axes, vec3(0.0), vec3(1.0));
|
||||
|
||||
blend = pow(blend_axes.x * blend_axes.y * blend_axes.z, 2.0);
|
||||
}
|
||||
blend = max(0.0, 1.0 - blend);
|
||||
blend = clamp(blend, 0.0, 1.0);
|
||||
|
||||
//reflect and make local
|
||||
vec3 ref_normal = normalize(reflect(vertex, normal));
|
||||
|
@ -875,21 +875,15 @@ void reflection_process(uint ref_index, vec3 vertex, vec3 ref_vec, vec3 normal,
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 inner_pos = abs(local_pos / box_extents);
|
||||
vec3 blend_axes = vec3(0.0, 0.0, 0.0);
|
||||
float blend = 0.0;
|
||||
if (reflections.data[ref_index].blend_distance != 0) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
float axis_blend_distance = min(reflections.data[ref_index].blend_distance, box_extents[i]);
|
||||
blend_axes[i] = (inner_pos[i] * box_extents[i]) - box_extents[i] + axis_blend_distance;
|
||||
blend_axes[i] = blend_axes[i] / axis_blend_distance;
|
||||
blend_axes[i] = clamp(blend_axes[i], 0.0, 1.0);
|
||||
}
|
||||
blend = pow((1.0 - blend_axes.x) * (1.0 - blend_axes.y) * (1.0 - blend_axes.z), 2);
|
||||
blend = 1 - blend;
|
||||
float blend = 1.0;
|
||||
if (reflections.data[ref_index].blend_distance != 0.0) {
|
||||
vec3 axis_blend_distance = min(vec3(reflections.data[ref_index].blend_distance), box_extents);
|
||||
vec3 blend_axes = abs(local_pos) - box_extents + axis_blend_distance;
|
||||
blend_axes /= axis_blend_distance;
|
||||
blend_axes = clamp(1.0 - blend_axes, vec3(0.0), vec3(1.0));
|
||||
|
||||
blend = pow(blend_axes.x * blend_axes.y * blend_axes.z, 2.0);
|
||||
}
|
||||
blend = max(0.0, 1.0 - blend);
|
||||
blend = clamp(blend, 0.0, 1.0);
|
||||
|
||||
if (reflections.data[ref_index].intensity > 0.0) { // compute reflection
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user